You are here

function facetapi_theme_hooks_set in Facet API 6

Recursive function that sets each item's theme hook dependent on whether the item is active or inactive.

Parameters

&$build: A render array containing the facet items.

$active_hook: A string containing the theme hook to use when the facet is active.

$inactive_hook: A string containing the theme hook to use when the facet is inactive.

1 call to facetapi_theme_hooks_set()
facetapi_widget_links in ./facetapi.widget.inc
Builds items as array of links that can be passed to theme_item_list().

File

./facetapi.module, line 951
An abstracted facet API that can be used by various search backens.

Code

function facetapi_theme_hooks_set(array &$build, $active_hook = NULL, $inactive_hook = NULL) {
  foreach ($build as $value => &$item) {
    if (empty($item['#active']) && NULL !== $inactive_hook) {
      $item['#theme'] = $inactive_hook;
    }
    if (!empty($item['#active']) && NULL !== $active_hook) {
      $item['#theme'] = $active_hook;
    }
    if (!empty($item['#item_children'])) {
      facetapi_theme_hooks_set($item['#item_children'], $active_hook, $inactive_hook);
    }
  }
}