class Linkedin in Social simple 2.0.x
Same name and namespace in other branches
- 8 src/SocialNetwork/Linkedin.php \Drupal\social_simple\SocialNetwork\Linkedin
The social network Linkedin.
Hierarchy
- class \Drupal\social_simple\SocialNetwork\Linkedin implements SocialNetworkInterface uses StringTranslationTrait
Expanded class hierarchy of Linkedin
1 string reference to 'Linkedin'
1 service uses Linkedin
File
- src/
SocialNetwork/ Linkedin.php, line 12
Namespace
Drupal\social_simple\SocialNetworkView source
class Linkedin implements SocialNetworkInterface {
use StringTranslationTrait;
/**
* The social network base share link.
*/
const LINKEDIN_URL = 'https://www.linkedin.com/shareArticle';
/**
* {@inheritdoc}
*/
public function getId() {
return 'linkedin';
}
/**
* {@inheritdoc}
*/
public function getLabel() {
return $this
->t('Linked in');
}
/**
* {@inheritdoc}
*/
public function getShareLink($share_url, $title = '', EntityInterface $entity = NULL, array $additional_options = []) {
$options = [
'query' => [
'mini' => 'true',
'url' => $share_url,
'title' => $title,
],
'absolute' => TRUE,
'external' => TRUE,
];
if ($additional_options) {
foreach ($additional_options as $id => $value) {
$options['query'][$id] = $value;
}
}
$url = Url::fromUri(self::LINKEDIN_URL, $options);
$link = [
'url' => $url,
'title' => [
'#markup' => '<i class="fa fa-linkedin"></i><span class="visually-hidden">' . $this
->getLabel() . '</span>',
],
'attributes' => $this
->getLinkAttributes($this
->getLabel()),
];
return $link;
}
/**
* {@inheritdoc}
*/
public function getLinkAttributes($network_name) {
$attributes = [
'data-popup-width' => 600,
'data-popup-height' => 300,
'data-toggle' => 'tooltip',
'data-placement' => 'top',
'title' => $network_name,
];
return $attributes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Linkedin:: |
public | function |
Get the network id. Overrides SocialNetworkInterface:: |
|
Linkedin:: |
public | function |
Get the network name. Overrides SocialNetworkInterface:: |
|
Linkedin:: |
public | function |
Get common attributes for the share link. Overrides SocialNetworkInterface:: |
|
Linkedin:: |
public | function |
Checks whether the given transition is allowed. Overrides SocialNetworkInterface:: |
|
Linkedin:: |
constant | The social network base share link. | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |