public function SocialSimpleGenerator::getShareUrl in Social simple 8
Same name and namespace in other branches
- 2.0.x src/SocialSimpleGenerator.php \Drupal\social_simple\SocialSimpleGenerator::getShareUrl()
Get the share url.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity if provided.
Return value
string $url The url to share.
Overrides SocialSimpleGeneratorInterface::getShareUrl
1 call to SocialSimpleGenerator::getShareUrl()
- SocialSimpleGenerator::generateSocialLinks in src/SocialSimpleGenerator.php 
- Build the social share links.
File
- src/SocialSimpleGenerator.php, line 172 
Class
- SocialSimpleGenerator
- Class SocialSimpleGenerator.
Namespace
Drupal\social_simpleCode
public function getShareUrl(EntityInterface $entity = NULL) {
  if ($entity) {
    $share_url = $entity
      ->toUrl('canonical', [
      'absolute' => TRUE,
    ])
      ->toString();
  }
  else {
    $share_url = Url::fromRoute('<current>', [], [
      'absolute' => 'true',
    ])
      ->toString();
  }
  return $share_url;
}