My main menu has 2 levels of items (menu and submenu), but the user toolbar only displays the first level.
The administration user toolbar does a good job at displaying 2 levels on a computer and even 3 levels in trays when the menu switches to vertical on a mobile (see cap) . Would it be possible to have the same behaviour?
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | display_all_levels_from-2658710-13.patch | 8.78 KB | vpeltot |
| admintoolbar.png | 15.36 KB | juliencarnot |
Comments
Comment #2
eme commented+1
It would be great to use this module in conjuction with Admin Toolbar (I'm co-maintainer of the module) to define administration menus depending for exemple on certain roles (for exemple a menu for contributors).
Comment #3
vpeltot commentedGreat Ideas !
This patch updates my module to add a compatibility with admin_toolbar (multi level menu + add specific classes to work with admin_toolbar properly).
@juliencarnot @eme can you test this patch ?
To test :
1. Apply this patch
2. Enable admin_toolbar
3. Create a menu with multi level / or add "administration" (currently multi level) menu in the toolbar
Normally you should see a multi level menu in toolbar.
@eme If is ok for you, I will add a reference + explanation to admin_toolbar module in my project page.
And if you can promote mine, it will be awesome !
Comment #4
juliencarnot commentedI applied the patch, but as soon as I added a menu to the toolbar, I got this message:
InvalidArgumentException: Class "toolbar_menu.menu_link_tree_manipulators" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 29 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).Comment #5
juliencarnot commentedSorry, missed the pmu before re-enabling, I don't have the error anymore. However, I added my main menu and the administration menu to the toolbar and I don't see any sublevel entries...
Comment #6
vpeltot commented@juliencarnot
Have you downloaded and enabled "admin_toolbar" menu?
Comment #7
juliencarnot commentedOk, I missed that too! ;-). Hovering over the items show the subitems in a dropdownmenu on a large screen. However, I don't get the rendering of all items and subitems on a smaller screen I was hoping for when the toolbar switches to vertical mode (see screen capture admintoolbar.png for example).
Comment #8
vpeltot commentedThe toolbar display on a smaller screen is manage by drupal itself, and by default each item is displayed like an icon.
Bug found:
When the toolbar is displayed on the left, the multi level doesn't work
Here comes a new patch with a to fix this.
@eme
Have you a moment to test this patch ?
Comment #9
juliencarnot commentedThanks @vpeltot!
Works perfectly for me!
Comment #10
vpeltot commentedArgh :/
Bug found.
When I disable admin_toolbar, the drupal responsive dropdown toolbar (sticky on the left) doesn't work perfectly :
Comment #11
juliencarnot commentedOuch. Didn't notice the third level issue, but reproduced the second point from time to time, not sure if caching is hiding it when it appears to work.
Another issue: adding the toolbar for the authentified users only resulted in blocking all javascript execution for anonymous visitors. "Drupal not defined" says the JS console...
Comment #12
vpeltot commentedI found where is the problem.
Drupal calls a JS present in toolbar.js to render the collapsible toolbar.
and more specificaly
Only the first toolbar element with the class 'toolbar-menu-administration' is rendered.
I tried to remove the
.get(0), everything works fine without this code.I don't like Javascript, and he don't like me !
So, how can I rewrite the
Drupal.toolbar.views.menuVisualViewobject ?Any idea ?
Comment #13
vpeltot commentedI found !
Here a new patch.
Everything should works now.
Comment #14
eme commentedIt works very well indeed ! Congrats.
Comment #16
vpeltot commentedPatch merged !
Thanks guys !
Comment #17
eme commentedLinked from Admin toolbar module page as it plays quite nicely now :-)