function PreprocessHooks::textFormatWrapper

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::textFormatWrapper()

Implements hook_preprocess_HOOK() for text_format_wrapper.

Attributes

#[Hook('preprocess_text_format_wrapper')]

File

core/themes/admin/src/Hook/PreprocessHooks.php, line 1199

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\admin\Hook

Code

public function textFormatWrapper(array &$variables) : void {
  // @todo Remove when https://www.drupal.org/node/3016343 is fixed.
  $description_attributes = [];
  if (!empty($variables['attributes']['id'])) {
    $description_attributes['id'] = $variables['attributes']['aria-describedby'] = $variables['attributes']['id'];
    unset($variables['attributes']['id']);
  }
  $variables['description_attributes'] = new Attribute($description_attributes);
  if (!empty($variables['description']) && Settings::getInstance()->get('show_description_toggle')) {
    $variables['description_display'] = 'invisible';
    $variables['description_toggle'] = TRUE;
  }
}

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