function template_preprocess_text_format_wrapper

Same name and namespace in other branches
  1. 8.9.x core/modules/filter/filter.module \template_preprocess_text_format_wrapper()
  2. 10 core/modules/filter/filter.module \template_preprocess_text_format_wrapper()
  3. 11.x core/modules/filter/filter.module \template_preprocess_text_format_wrapper()

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 378

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']);
    }
}

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