You are here

protected function EntityReferenceFacetLink::buildElement in Entity Reference Facet Link 8

Builds a single element's render array.

Parameters

\Drupal\Core\Url $url: The processed facet URL.

\Drupal\Core\Entity\EntityInterface $entity: The entity being displayed.

Return value

array A render array.

Overrides EntityReferenceFacetFormatterBase::buildElement

File

src/Plugin/Field/FieldFormatter/EntityReferenceFacetLink.php, line 25

Class

EntityReferenceFacetLink
Plugin implementation of the 'entity reference facet link' formatter.

Namespace

Drupal\entity_reference_facet_link\Plugin\Field\FieldFormatter

Code

protected function buildElement(Url $url, EntityInterface $entity) {
  return [
    '#type' => 'link',
    '#title' => $entity
      ->label(),
    '#url' => $url,
  ];
}