function webform_preprocess_details in Webform 8.5
Same name and namespace in other branches
- 6.x includes/webform.theme.inc \webform_preprocess_details()
Implements hook_preprocess_details() for details element templates.
File
- includes/
webform.theme.inc, line 407 - Theme hooks, preprocessor, and suggestions.
Code
function webform_preprocess_details(&$variables) {
if (!WebformElementHelper::isWebformElement($variables['element'])) {
return;
}
// Setup description, help, and more.
_webform_preprocess_element($variables);
$element =& $variables['element'];
// Hide details title.
if (isset($element['#title_display']) && $element['#title_display'] === 'invisible') {
$variables['title'] = WebformAccessibilityHelper::buildVisuallyHidden($variables['title']);
}
// Remove invalid 'required' and 'aria-required' attributes from details.
if (isset($element['#webform_key'])) {
unset($variables['attributes']['required'], $variables['attributes']['aria-required']);
}
}