I created the toolbar with hook_toolbar()
, but I want the drop-downs to be horizontal and I get them vertical.
function try_toolbar() {
$items = [];
$items['TRY'] = [
'#cache' => [
'contexts' => ['user.permissions'],
],
];
if (!\Drupal::currentUser()->hasPermission('Access the Commande overview page')) {
return $items;
}
$items['TRY'] += [
'#type' => 'toolbar_item',
'tab' => [
'#type' => 'link',
'#title' => 'TRY',
'#url' => \Drupal\Core\Url::fromUri("internal:/admin/TRY"),
'#attributes' => [
'title' => 'TRY menu',
'class' => ['toolbar-icon', 'toolbar-icon'],
],
],
'tray' => [
'children' => [
[
'#type' => 'link',
'#title' => 'Dashboard',
'#url' => \Drupal\Core\Url::fromUri("internal:/admin/dashboard"),
],
[
'#type' => 'link',
'#title' => 'Notifications',
'#url' => \Drupal\Core\Url::fromUri("internal:/admin/notifications"),
],
[
'#type' => 'link',
'#title' => 'Settings',
'#url' => \Drupal\Core\Url::fromUri("internal:/admin/settings"),
],
[
'#type' => 'link',
'#title' => 'Help',
'#url' => \Drupal\Core\Url::fromUri("internal:/admin/help"),
],
],
'#attached' => array(
'library' => array(
'try/admin',
),
),
];
return $items;
}
}
The following screenshots show the view I get and the view I want.

