You are here

protected function FacetapiFacetProcessor::processQueryStrings in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 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
Builds the base render array used as a starting point for rendering.

File

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

Class

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

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.
      $settings = $this->facet
        ->getSettings();
      if (!$settings->settings['individual_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']);
  }
}