function ClaroPreRender::textFormat

Same name in other branches
  1. 9 core/themes/claro/src/ClaroPreRender.php \Drupal\claro\ClaroPreRender::textFormat()
  2. 8.9.x core/themes/claro/src/ClaroPreRender.php \Drupal\claro\ClaroPreRender::textFormat()
  3. 10 core/themes/claro/src/ClaroPreRender.php \Drupal\claro\ClaroPreRender::textFormat()

Prerender callback for text_format elements.

File

core/themes/claro/src/ClaroPreRender.php, line 156

Class

ClaroPreRender
Implements trusted prerender callbacks for the Claro theme.

Namespace

Drupal\claro

Code

public static function textFormat($element) {
    // Add clearfix for filter wrapper.
    $element['format']['#attributes']['class'][] = 'clearfix';
    // Hide format select label visually.
    $element['format']['format']['#wrapper_attributes']['class'][] = 'form-item--editor-format';
    $element['format']['format']['#attributes']['class'][] = 'form-element--extrasmall';
    $element['format']['format']['#attributes']['class'][] = 'form-element--editor-format';
    // Fix JS inconsistencies of the 'text_textarea_with_summary' widgets.
    // @todo Remove when https://www.drupal.org/node/3016343 is fixed.
    if (!empty($element['summary']) && $element['summary']['#type'] === 'textarea') {
        $element['#attributes']['class'][] = 'js-text-format-wrapper';
        $element['value']['#wrapper_attributes']['class'][] = 'js-form-type-textarea';
    }
    return $element;
}

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