You are here

protected function FacetapiFacetProcessor::processQueryStrings in Facet API 6.3

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

Initializes the render array's query string variables.

Parameters

array &$build: The initialized render array.

1 call to FacetapiFacetProcessor::processQueryStrings()
FacetapiFacetProcessor::process in plugins/facetapi/adapter.inc
Processes the facet items.

File

plugins/facetapi/adapter.inc, line 1324
Adapter plugin and adapter related calsses.

Class

FacetapiFacetProcessor
Processes facets, initializes the build.

Code

protected function processQueryStrings(array &$build) {
  foreach ($build as $value => &$item) {
    $values = array(
      $value,
    );

    // Calculate paths for the children.
    if (!empty($item['#item_children'])) {
      $this
        ->processQueryStrings($item['#item_children']);

      // Merges the childrens' values if the item is active so the children
      // are deactivated along with the parent.
      if ($item['#active']) {
        $values = array_merge(facetapi_get_child_values($item['#item_children']), $values);
      }
    }

    // Stores this item's active children so we can deactivate them in the
    // current search block as well.
    $this->activeChildren[$value] = $values;

    // Formats path and query string for facet item, sets theme function.
    $item['#path'] = $this
      ->getFacetPath($values, $item['#active']);
    $item['#query'] = $this
      ->getQueryString($values, $item['#active']);
  }
}