You are here

public function FacetapiFacetProcessor::process in Facet API 7.2

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

Builds the base render array used as a starting point for rendering.

This method takes the following actions:

  • Maps index values to their human readable values.
  • Processes hierarchical data.
  • Builds each facet item's query string variables.

File

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

Class

FacetapiFacetProcessor
Builds base render array used as a starting point for rendering.

Code

public function process() {
  $this->build = array();

  // Only initializes facet if a query type plugin is registered for it.
  // NOTE: We don't use the chaining pattern so the methods can be tested.
  if ($this->facet
    ->getAdapter()
    ->getFacetQuery($this->facet
    ->getFacet())) {
    $this->build = $this
      ->initializeBuild($this->build);
    $this->build = $this
      ->mapValues($this->build);
    if ($this->build) {
      $settings = $this->facet
        ->getSettings();
      if (!$settings->settings['flatten']) {
        $this->build = $this
          ->processHierarchy($this->build);
      }
      $this
        ->processQueryStrings($this->build);
    }
  }
}