You are here

protected function FacetapiAjaxWidget::getAjaxFacetsUuid in Ajax facets 7.3

Returns uuid for the facet widget. It's need to identify the facet option.

Parameters

null $value: Some facets have many separate input elements. For example checkboxes or links. We need $value to identify each option.

1 call to FacetapiAjaxWidget::getAjaxFacetsUuid()
FacetapiAjaxWidgetCheckboxes::buildListItems in plugins/facetapi/ajax_widget_checkboxes.inc
Transforms the render array for use with theme_item_list().

File

plugins/facetapi/ajax_widget.inc, line 84
Base ajax_facets widget

Class

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

Code

protected function getAjaxFacetsUuid($value = NULL) {
  $to_replace = [
    '_',
    ' ',
    ':',
  ];
  switch ($this->id) {
    case 'facetapi_ajax_select':
    case 'facetapi_ajax_ranges':
      return str_replace('_', '-', $this->id) . '-' . str_replace($to_replace, '-', $this->key);
      break;
    case 'facetapi_ajax_links':
    case 'facetapi_ajax_checkboxes':
      return str_replace('_', '-', $this->id) . '-' . str_replace($to_replace, '-', $this->key . '-' . drupal_strtolower($value));
      break;
  }
}