Score:0

How can I convert the vertical dropdown to horizontal?

pg flag

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.

The view I have right now

The view I want

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.