You are here

protected function ShowSummaryProcessor::getActiveDisplayValues in Facets 8

Get all active results' display values from hierarchy.

Parameters

\Drupal\facets\Result\ResultInterface[] $results: The results to check for active children.

Return value

\Drupal\facets\Result\ResultInterface[] The active results found.

1 call to ShowSummaryProcessor::getActiveDisplayValues()
ShowSummaryProcessor::build in modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php
Alter the items in the summary before creating the renderable array.

File

modules/facets_summary/src/Plugin/facets_summary/processor/ShowSummaryProcessor.php, line 61

Class

ShowSummaryProcessor
Provides a processor that shows a summary of all selected facets.

Namespace

Drupal\facets_summary\Plugin\facets_summary\processor

Code

protected function getActiveDisplayValues(array $results) {
  $items = [];
  foreach ($results as $result) {
    if ($result
      ->isActive()) {
      $items[] = $result
        ->getDisplayValue();
    }
    if ($result
      ->hasActiveChildren()) {
      $items = array_merge($items, $this
        ->getActiveDisplayValues($result
        ->getChildren()));
    }
  }
  return $items;
}