Adding custom menu tabs and menu items to navbar
Mobile Friendly Navigation Toolbar, shortly known as navbar, is a back-port of toolbar in Drupal 8. The problem it tries to solve is pretty obvious from it's name.
Navbar is an often used module in our Drupal projects. In our recent project we were asked to develop a bunch of menus to quickly access admin pages as and when needed. Unlike Shortcuts, we want this appear dynamically like notification.
For instance, if there are any new comments awaiting approval, the menu should show up and a few more items similar to this. Thought, Navbar could be leveraged for this requirements.
This mighty developer friendly module makes this possible for any module by implementing hook_navbar(). Similar to hook_menu(), an array of menu items to be returned but in renderable array format. If you need an example, function navbar_navbar() is a good place to get started.
The menu it offers can be seen as,
- The navbar tab by its name acting as menu item (e.g. Home)
- The navbar tab on click expands to show menu item(s) it has got underneath (e.g. Shortcuts) depends on the way navbar item defined in the hook_navbar().
Example code for #1,