You are here

protected function ExtraFieldEntityLinkPlugin::buildEntityLink in Entity Extra Field 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/ExtraFieldType/ExtraFieldEntityLinkPlugin.php \Drupal\entity_extra_field\Plugin\ExtraFieldType\ExtraFieldEntityLinkPlugin::buildEntityLink()

Build the entity link.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity instance.

Return value

\Drupal\Core\Link The entity link instance.

Throws

\Drupal\Core\Entity\EntityMalformedException

1 call to ExtraFieldEntityLinkPlugin::buildEntityLink()
ExtraFieldEntityLinkPlugin::build in src/Plugin/ExtraFieldType/ExtraFieldEntityLinkPlugin.php
Build the render array of the extra field type contents.

File

src/Plugin/ExtraFieldType/ExtraFieldEntityLinkPlugin.php, line 226

Class

ExtraFieldEntityLinkPlugin
Define the extra field entity link type.

Namespace

Drupal\entity_extra_field\Plugin\ExtraFieldType

Code

protected function buildEntityLink(EntityInterface $entity) : Link {
  $configuration = $this
    ->getConfiguration();
  return $entity
    ->toLink($configuration['link_text'], $configuration['link_template'], $this
    ->getEntityLinkOptions());
}