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']);
  }
}
doc_Drupal
2016-10-29 09:46:49
Comments
Leave a Comment

Please login to continue.