function FacetapiAjaxWidgetRanges::buildListItems in Ajax facets 7.3
Transforms the render array for use with theme_item_list().
1 call to FacetapiAjaxWidgetRanges::buildListItems()
- FacetapiAjaxWidgetRanges::execute in plugins/
facetapi/ ajax_widget_ranges.inc - Implements FacetapiWidget::execute().
File
- plugins/
facetapi/ ajax_widget_ranges.inc, line 25 - The facetapi_links and facetapi_checkbox_links widget plugin classes.
Class
- FacetapiAjaxWidgetRanges
- Widget that renders facets as a range of values.
Code
function buildListItems($build, $level = 0) {
// Builds rows.
$items = [];
$active_items = [];
$have_active = FALSE;
foreach ($build as $value => $item) {
// Respect current selection.
if (!empty($item['#active'])) {
$items['active_value'] = $value;
$have_active = TRUE;
$active_items[] = $this->key . ':' . $item['#markup'];
}
$items['values'][$item['#indexed_value']] = $item['#indexed_value'];
}
$this->jsSettings['haveActiveSelection'] = $this->settings->settings['have_active_selection'] = $have_active;
sort($active_items);
$this->jsSettings['activeItems'] = $active_items;
// Generate reset path on server side to make possible to use aliases.
if ($have_active) {
$this->jsSettings['resetPath'] = ajax_facets_facet_build_reset_path($this->facet
->getFacet(), $this->facet
->getAdapter());
}
return $items;
}