function StringFormatter::getEntityUrl
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::getEntityUrl()
- 8.9.x 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 184
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\EntityBase::toUrl()
$rel = $entity->getEntityType()
->hasLinkTemplate('revision') ? 'revision' : 'canonical';
return $entity->toUrl($rel);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.