You are here

protected function FacetapiWidgetLinks::setThemeHooks in Facet API 7

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/widget_links.inc \FacetapiWidgetLinks::setThemeHooks()
  2. 7.2 plugins/facetapi/widget_links.inc \FacetapiWidgetLinks::setThemeHooks()

Recursive function that sets each item's theme hook.

The individual items will be rendered by different theme hooks depending on whether or not they are active.

Parameters

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

Return value

FacetapiWidget An instance of this class.

See also

theme_facetapi_link_active()

theme_facetapi_link_inactive()

1 call to FacetapiWidgetLinks::setThemeHooks()
FacetapiWidgetLinks::execute in plugins/facetapi/widget_links.inc
Implements FacetapiWidget::execute().

File

plugins/facetapi/widget_links.inc, line 66
The facetapi_links and facetapi_checkbox_links widget plugin classes.

Class

FacetapiWidgetLinks
Widget that renders facets as a list of clickable links.

Code

protected function setThemeHooks(array &$build) {
  foreach ($build as $value => &$item) {
    $item['#theme'] = $item['#active'] ? 'facetapi_link_active' : 'facetapi_link_inactive';
    if (!empty($item['#item_children'])) {
      $this
        ->setThemeHooks($item['#item_children']);
    }
  }
  return $this;
}