Skip to content

Commit

Permalink
Merge pull request #1 from micahhenshaw/master
Browse files Browse the repository at this point in the history
Added text parameter option to Facebook
  • Loading branch information
aerni authored Jul 8, 2020
2 parents 9dfe7be + 7800552 commit 0c28330
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ You may pass the following parameters to customize the generated link.
| Name | Description | Usage |
|------|-------------|-------|
| `url` | The URL of the page to share | Optional
| `text` | The text of your post | Optional

### Twitter

Expand Down Expand Up @@ -96,4 +97,4 @@ You may pass the following parameters to customize the generated link.
| `cc` | The email address to CC | Optional
| `bcc` | The email address to BCC | Optional
| `subject` | The subject of the email | Optional
| `body` | The body of the email | Optional
| `body` | The body of the email | Optional
4 changes: 2 additions & 2 deletions SocialLinks/SocialLinksTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public function createLink(string $channel): string
$params = $this->getParams();

if ($channel === 'facebook') {
return "https://www.facebook.com/sharer/sharer.php?u={$params['url']}";
return "https://www.facebook.com/sharer/sharer.php?u={$params['url']}&quote={$params['text']}";
}

if ($channel === 'twitter') {
return "https://twitter.com/intent/tweet?url={$params['url']}&text={$params['text']}&via={$params['handle']}";
}

if ($channel === 'linkedin') {
return "https://www.linkedin.com/shareArticle?mini=true&url={$params['url']}&title={$params['title']}&summary={$params['text']}&source={$params['source']}";
}
Expand Down

0 comments on commit 0c28330

Please sign in to comment.