function template_preprocess_bef_checkboxes in Better Exposed Filters 8.4
Same name and namespace in other branches
- 8.5 includes/better_exposed_filters.theme.inc \template_preprocess_bef_checkboxes()
- 8.3 better_exposed_filters.module \template_preprocess_bef_checkboxes()
Prepares variables for bef-checkboxes template.
Default template: bef-checkboxes.html.twig.
Parameters
array $variables: An associative array containing:
- element: An associative array containing the exposed form element.
File
- includes/
better_exposed_filters.theme.inc, line 89 - Theme hooks, preprocessor, and suggestions.
Code
function template_preprocess_bef_checkboxes(array &$variables) {
$element =& $variables['element'];
// Create new wrapper attributes since the element attributes will be used
// on the fieldset (@see template_preprocess_fieldset).
$variables['wrapper_attributes'] = new Attribute();
$variables['children'] = Element::children($element);
$variables['show_select_all_none'] = $element['#bef_select_all_none'] ?? FALSE;
$variables['show_select_all_none_nested'] = $element['#bef_select_all_none_nested'] ?? FALSE;
$variables['display_inline'] = $element['#bef_display_inline'] ?? FALSE;
// Set element name.
$variables['attributes']['name'] = $element['#name'];
// Handle nested checkboxes.
if (!empty($variables['element']['#bef_nested'])) {
_bef_preprocess_nested_elements($variables);
}
}