public function SocialSharingLinkedin::getValue in More Global Variables 8
Method that implement generating value of global variable.
Return value
mixed Return value of declared variable.
Overrides GlobalVariableInterface::getValue
File
- src/
Plugin/ GlobalVariable/ SocialSharingLinkedin.php, line 28
Class
- SocialSharingLinkedin
- Class SocialSharingLinkedin.
Namespace
Drupal\mgv\Plugin\GlobalVariableCode
public function getValue() {
// Social Sharing Global Variables
//
// To use this, you need to wrap the variable in an anchor tag, such as:
// <a href="{{ global_variables.social_sharing.linkedin }}">Linkedin</a>
//
// Share the current page on Twitter.
return Url::fromUri('https://www.linkedin.com/shareArticle', [
'absolute' => TRUE,
'https' => TRUE,
'query' => [
'mini' => 'true',
'url' => $this
->getDependency('base_url') . $this
->getDependency('current_path'),
'title' => $this
->getDependency('current_page_title'),
'source' => $this
->getDependency('site_name'),
],
])
->toUriString();
}