template_preprocess_details(&$variables)
Prepares variables for details element templates.
Default template: details.html.twig.
array $variables: An associative array containing:
function template_preprocess_details(&$variables) { $element = $variables['element']; $variables['attributes'] = $element['#attributes']; $variables['summary_attributes'] = new Attribute(); if (!empty($element['#title'])) { $variables['summary_attributes']['role'] = 'button'; if (!empty($element['#attributes']['id'])) { $variables['summary_attributes']['aria-controls'] = $element['#attributes']['id']; } $variables['summary_attributes']['aria-expanded'] = !empty($element['#attributes']['open']) ? 'true' : 'false'; $variables['summary_attributes']['aria-pressed'] = $variables['summary_attributes']['aria-expanded']; } $variables['title'] = (!empty($element['#title'])) ? $element['#title'] : ''; $variables['description'] = (!empty($element['#description'])) ? $element['#description'] : ''; $variables['children'] = (isset($element['#children'])) ? $element['#children'] : ''; $variables['value'] = (isset($element['#value'])) ? $element['#value'] : ''; // Suppress error messages. $variables['errors'] = NULL; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!form.inc/function/template_preprocess_details/8.1.x