You are here

public function HideWhenNotRenderedProcessor::build in Facets 8

Alter the items in the summary before creating the renderable array.

Parameters

\Drupal\facets_summary\FacetsSummaryInterface $facet: The facet being changed.

array $build: The render array.

\Drupal\facets\FacetInterface[] $facets: The facets that are available.

Return value

array The render array.

Overrides BuildProcessorInterface::build

File

modules/facets_summary/src/Plugin/facets_summary/processor/HideWhenNotRenderedProcessor.php, line 27

Class

HideWhenNotRenderedProcessor
Provides a processor that hides the summary when the source was not rendered.

Namespace

Drupal\facets_summary\Plugin\facets_summary\processor

Code

public function build(FacetsSummaryInterface $facets_summary, array $build, array $facets) {
  $facet_source = $facets_summary
    ->getFacetSource();
  if (!$facet_source
    ->isRenderedInCurrentRequest()) {
    return [];
  }
  return $build;
}