function FilterThemeHooks::preprocessTextFormatWrapper
Same name and namespace in other branches
- main core/modules/filter/src/Hook/FilterThemeHooks.php \Drupal\filter\Hook\FilterThemeHooks::preprocessTextFormatWrapper()
Prepares variables for text format wrapper templates.
Default template: text-format-wrapper.html.twig.
Parameters
array $variables: An associative array containing:
- attributes: An associative array containing properties of the element.
File
-
core/
modules/ filter/ src/ Hook/ FilterThemeHooks.php, line 87
Class
- FilterThemeHooks
- Theme hooks for filter.
Namespace
Drupal\filter\HookCode
public function preprocessTextFormatWrapper(array &$variables) : void {
$variables['aria_description'] = FALSE;
// Add element class and id for screen readers.
if (isset($variables['attributes']['aria-describedby'])) {
$variables['aria_description'] = TRUE;
$variables['attributes']['id'] = $variables['attributes']['aria-describedby'];
// Remove aria-describedby attribute as it shouldn't be visible here.
unset($variables['attributes']['aria-describedby']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.