You are here

function responsive_menu_preprocess_toolbar in Responsive and off-canvas menu 4.0.x

Same name and namespace in other branches
  1. 8.3 responsive_menu.module \responsive_menu_preprocess_toolbar()
  2. 8.2 responsive_menu.module \responsive_menu_preprocess_toolbar()
  3. 4.4.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 393
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';
}