protected function ArrayWidget::prepare in Facets 8
Prepares the URL and values for the facet.
Parameters
\Drupal\facets\Result\ResultInterface $result: A result item.
Return value
array The results.
1 call to ArrayWidget::prepare()
- ArrayWidget::buildListItems in src/
Plugin/ facets/ widget/ ArrayWidget.php - Builds a renderable array of result items.
File
- src/
Plugin/ facets/ widget/ ArrayWidget.php, line 75
Class
- ArrayWidget
- A simple widget class that returns a simple array of the facet results.
Namespace
Drupal\facets\Plugin\facets\widgetCode
protected function prepare(ResultInterface $result) {
$values = $this
->generateValues($result);
if (is_null($result
->getUrl())) {
$facet_values = $values;
}
else {
$facet_values['url'] = $result
->getUrl()
->setAbsolute()
->toString();
$facet_values['values'] = $values;
}
return $facet_values;
}