You are here

function FacetapiFacet::processQueryStrings in Facet API 6

Initializes the render array's query string variables.

Parameters

&$build: The facet's render array.

Return value

An instance of this class.

File

./facetapi.adapter.inc, line 610
Defines classes used by the FacetAPI module.

Class

FacetapiFacet
Stores facet data, provides methods that build the facet's render array.

Code

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

    // If the item is active an has children, gets the paths for the children.
    // Merges child values with this facet item's value so that unclicking the
    // parent deactivated the children as well.
    if (!empty($item['#active']) && !empty($item['#item_children'])) {
      $this
        ->processQueryStrings($item['#item_children']);
      $values = array_merge(facetapi_child_values_get($item['#item_children']), $values);
    }

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

  // Returns instance of this calss.
  return $this;
}