protected function FacetapiMultiSelectWidget::getOptionKey in Facetapi Multiselect 7
Gets the key to use for an item in the select element #options array.
1 call to FacetapiMultiSelectWidget::getOptionKey()
- FacetapiMultiSelectWidget::buildOptions in plugins/
facetapi/ facetapi_multiselect.inc - Builds an array of #options for our select element.
File
- plugins/
facetapi/ facetapi_multiselect.inc, line 86 - Defines a plugin for a multiselect facet API widget.
Class
- FacetapiMultiSelectWidget
- Widget that renders facets as a multiselect element.
Code
protected function getOptionKey($item) {
$settings = $this->settings->settings;
if ($settings['act_single'] && isset($item['#query']['f'])) {
return implode('&', $item['#query']['f']);
}
// Set the key to the filter that will appear in the URL if this item is
// selected. We need to do it this way (rather than using $item['#query'])
// so that multiple selections can be combined together in the form's
$facet_url = drupal_encode_path($this->facet['field alias']) . ':' . $item['#indexed_value'];
if (isset($settings['disable_empty']) && $settings['disable_empty'] == 1 && $item['#count'] == 0) {
// Submit handler. ":disabled" is added for facets with 0 items.
$facet_url .= ':disabled';
}
return $facet_url;
}