protected function StringFormatter::getEntityUrl in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::getEntityUrl()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::getEntityUrl()
Gets the URI elements of the entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object.
Return value
\Drupal\Core\Url The URI elements of the entity.
1 call to StringFormatter::getEntityUrl()
- StringFormatter::viewElements in core/lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ StringFormatter.php 
- Builds a renderable array for a field value.
1 method overrides StringFormatter::getEntityUrl()
- CommentPermalinkFormatter::getEntityUrl in core/modules/ comment/ src/ Plugin/ Field/ FieldFormatter/ CommentPermalinkFormatter.php 
- Gets the URI elements of the entity.
File
- core/lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ StringFormatter.php, line 174 
Class
- StringFormatter
- Plugin implementation of the 'string' formatter.
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterCode
protected function getEntityUrl(EntityInterface $entity) {
  // For the default revision, the 'revision' link template falls back to
  // 'canonical'.
  // @see \Drupal\Core\Entity\Entity::toUrl()
  $rel = $entity
    ->getEntityType()
    ->hasLinkTemplate('revision') ? 'revision' : 'canonical';
  return $entity
    ->toUrl($rel);
}