You are here

function template_preprocess_bef_radios in Better Exposed Filters 8.4

Same name and namespace in other branches
  1. 8.5 includes/better_exposed_filters.theme.inc \template_preprocess_bef_radios()
  2. 8.3 better_exposed_filters.module \template_preprocess_bef_radios()

Prepares variables for bef-radios template.

Default template: bef-radios.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 119
Theme hooks, preprocessor, and suggestions.

Code

function template_preprocess_bef_radios(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['display_inline'] = $element['#bef_display_inline'] ?? FALSE;

  // Set element name.
  $variables['attributes']['name'] = $element['#name'];

  // Handle nested radio buttons.
  if (!empty($variables['element']['#bef_nested'])) {
    _bef_preprocess_nested_elements($variables);
  }
}