You are here

function toolbar_themes_toolbar_alter in Toolbar Themes 8

Implements hook_toolbar_alter().

Parameters

$items:

File

./toolbar_themes.module, line 84

Code

function toolbar_themes_toolbar_alter(&$items) {

  // If tabs are hidden we unset all but the Manage tab, otherwise it becomes
  // extremely problematic if the toolbar is showing anything other than Manage
  // and in horizontal orientation at the time the settings are saved (it blows
  // up and can hide the entire menu off screen, ouch...).
  if (\Drupal::config('toolbar_themes.settings')
    ->get('tabs') === 0) {
    foreach ($items as $id => $item) {
      if ($id !== 'administration') {
        unset($items[$id]);
      }
    }
  }
}