You are here

function facetapi_get_child_values in Facet API 7.2

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

Recursive function that returns an array of values for all descendants of a facet item.

Parameters

$build: A render array containing the facet item's children.

Return value

An array containing the values of all descendants.

1 call to facetapi_get_child_values()
FacetapiFacetProcessor::processQueryStrings in plugins/facetapi/adapter.inc
Initializes the render array's query string variables.

File

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

Code

function facetapi_get_child_values(array $build) {
  $values = array_keys($build);
  foreach ($build as $item) {
    if (!empty($item['#item_children'])) {
      $values = array_merge(facetapi_get_child_values($item['#item_children']), $values);
    }
  }
  return $values;
}