You are here

public function UrlProcessorPluginBase::setActiveItems in Facets 8

Sets active items.

Is called after the url processor is ready retrieving and altering the active filters to let the facet know about the active items.

Parameters

\Drupal\facets\FacetInterface $facet: The facet that is edited.

Overrides UrlProcessorInterface::setActiveItems

File

src/UrlProcessor/UrlProcessorPluginBase.php, line 142

Class

UrlProcessorPluginBase
A base class for plugins that implements most of the boilerplate.

Namespace

Drupal\facets\UrlProcessor

Code

public function setActiveItems(FacetInterface $facet) {

  // Get the filter key of the facet.
  if (isset($this->activeFilters[$facet
    ->id()])) {
    foreach ($this->activeFilters[$facet
      ->id()] as $value) {
      $facet
        ->setActiveItem(trim($value, '"'));
    }
  }
}