You are here

public function FacetapiAdapter::processFacets in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/adapter.inc \FacetapiAdapter::processFacets()
  2. 7 plugins/facetapi/adapter.inc \FacetapiAdapter::processFacets()

Initializes facet builds, sets the breadcrumb trail.

Facets are built via FacetapiFacetProcessor objects. Facets only need to be processed, or built, once regardless of how many realms they are rendered in. The FacetapiAdapter::processed semaphore is set when this method is called ensuring that facets are built only once regardless of how many times this method is called.

@todo For clarity, should this method be named buildFacets()?

1 call to FacetapiAdapter::processFacets()
FacetapiAdapter::buildRealm in plugins/facetapi/adapter.inc
Uses each facet's widget to build the realm's render array.

File

plugins/facetapi/adapter.inc, line 1024
Adapter plugin and adapter related classes.

Class

FacetapiAdapter
Abstract class extended by Facet API adapters.

Code

public function processFacets() {
  if (!$this->processed) {
    $this->processed = TRUE;

    // Initialize each facet's render array. This render array is a common
    // base for all realms and widgets.
    foreach ($this
      ->getEnabledFacets() as $facet) {
      $processor = new FacetapiFacetProcessor($this
        ->getFacet($facet));
      $this->processors[$facet['name']] = $processor;
      $this->processors[$facet['name']]
        ->process();
    }

    // Set the breadcrumb trail if a search was executed.
    if ($this
      ->searchExecuted()) {
      $this->urlProcessor
        ->setBreadcrumb();
    }
  }
}