You are here

function responsive_menu_preprocess_toolbar in Responsive and off-canvas menu 8.3

Same name and namespace in other branches
  1. 8.2 responsive_menu.module \responsive_menu_preprocess_toolbar()
  2. 4.4.x responsive_menu.module \responsive_menu_preprocess_toolbar()
  3. 4.0.x responsive_menu.module \responsive_menu_preprocess_toolbar()
  4. 4.1.x responsive_menu.module \responsive_menu_preprocess_toolbar()
  5. 4.3.x responsive_menu.module \responsive_menu_preprocess_toolbar()

Implements hook_preprocess_toolbar().

Used to add a javascript file which overrides a method on the toolbar.

File

./responsive_menu.module, line 453
Contains procedural code.

Code

function responsive_menu_preprocess_toolbar(&$variables) {

  // Get the configuration.
  $config = \Drupal::config('responsive_menu.settings');

  // If this is the admin theme and allow_admin is disabled then don't
  // add the override to the toolbar.
  if (!$config
    ->get('allow_admin') && _current_theme_is_admin()) {
    return;
  }
  $variables['#attached']['library'][] = 'responsive_menu/responsive_menu.toolbar';
}