function PreprocessHooks::preprocessTextFormatWrapper

Same name and namespace in other branches
  1. main core/themes/default_admin/src/Hook/PreprocessHooks.php \Drupal\default_admin\Hook\PreprocessHooks::preprocessTextFormatWrapper()

Implements hook_preprocess_HOOK() for text_format_wrapper.

Attributes

#[Hook('preprocess_text_format_wrapper')]

File

core/themes/default_admin/src/Hook/PreprocessHooks.php, line 1187

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\default_admin\Hook

Code

public function preprocessTextFormatWrapper(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.