function ToolbarThemeHooks::preprocessHtml

Same name and namespace in other branches
  1. 11.x core/modules/toolbar/src/Hook/ToolbarThemeHooks.php \Drupal\toolbar\Hook\ToolbarThemeHooks::preprocessHtml()

Implements hook_preprocess_HOOK() for HTML document templates.

Attributes

#[Hook('preprocess_html')]

File

core/modules/toolbar/src/Hook/ToolbarThemeHooks.php, line 112

Class

ToolbarThemeHooks
Hook implementations for toolbar.

Namespace

Drupal\toolbar\Hook

Code

public function preprocessHtml(&$variables) : void {
  if (!\Drupal::currentUser()->hasPermission('access toolbar')) {
    return;
  }
  $variables['attributes']['class'][] = 'toolbar-loading';
}

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