You are here

protected function ArrayWidget::generateValues in Facets 8

Generates the value and the url.

Parameters

\Drupal\facets\Result\ResultInterface $result: The result to extract the values.

Return value

array The values.

3 calls to ArrayWidget::generateValues()
ArrayWidget::build in src/Plugin/facets/widget/ArrayWidget.php
Builds the facet widget for rendering.
ArrayWidget::buildChildren in src/Plugin/facets/widget/ArrayWidget.php
Builds an array for children results.
ArrayWidget::prepare in src/Plugin/facets/widget/ArrayWidget.php
Prepares the URL and values for the facet.

File

src/Plugin/facets/widget/ArrayWidget.php, line 121

Class

ArrayWidget
A simple widget class that returns a simple array of the facet results.

Namespace

Drupal\facets\Plugin\facets\widget

Code

protected function generateValues(ResultInterface $result) {
  $values['value'] = $result
    ->getDisplayValue();
  if ($this
    ->getConfiguration()['show_numbers'] && $result
    ->getCount() !== FALSE) {
    $values['count'] = $result
      ->getCount();
  }
  if ($result
    ->isActive()) {
    $values['active'] = 'true';
  }
  return $values;
}