function template_preprocess_text_format_wrapper

template_preprocess_text_format_wrapper(&$variables)

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/filter.module, line 390
Framework for handling the filtering of content.

Code

function template_preprocess_text_format_wrapper(&$variables) {
  $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']);
  }
}

© 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!modules!filter!filter.module/function/template_preprocess_text_format_wrapper/8.1.x