function template_preprocess_checkboxes

Same name in other branches
  1. 9 core/includes/form.inc \template_preprocess_checkboxes()
  2. 8.9.x core/includes/form.inc \template_preprocess_checkboxes()
  3. 11.x core/includes/form.inc \template_preprocess_checkboxes()

Prepares variables for checkboxes templates.

Default template: checkboxes.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #children, #attributes.

File

core/includes/form.inc, line 307

Code

function template_preprocess_checkboxes(&$variables) {
    $element = $variables['element'];
    $variables['attributes'] = [];
    if (isset($element['#id'])) {
        $variables['attributes']['id'] = $element['#id'];
    }
    if (isset($element['#attributes']['title'])) {
        $variables['attributes']['title'] = $element['#attributes']['title'];
    }
    $variables['children'] = $element['#children'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.