You are here

protected function WidgetPluginBase::prepareLink in Facets 8

Returns the text or link for an item.

Parameters

\Drupal\facets\Result\ResultInterface $result: A result item.

Return value

array The item as a render array.

1 call to WidgetPluginBase::prepareLink()
WidgetPluginBase::buildListItems in src/Widget/WidgetPluginBase.php
Builds a renderable array of result items.

File

src/Widget/WidgetPluginBase.php, line 223

Class

WidgetPluginBase
A base class for widgets that implements most of the boilerplate.

Namespace

Drupal\facets\Widget

Code

protected function prepareLink(ResultInterface $result) {
  $item = $this
    ->buildResultItem($result);
  if (!is_null($result
    ->getUrl())) {
    $item = (new Link($item, $result
      ->getUrl()))
      ->toRenderable();
  }
  return $item;
}