Implement hook_navbar_view_alter to allow other modules to modify navbar links.

CommentFileSizeAuthor
#1 navbar-alter-navbar-links-1888322-1.patch585 bytesshadcn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shadcn’s picture

Status: Active » Needs review
FileSize
585 bytes
redndahead’s picture

I'll second this request. I haven't tested the code, but by the looks of it it should work just fine.

markwk’s picture

Yes, I would like to see this feature added. I haven't reviewed or even checked this code but functionally we should add this so other modules can modify the menu items some.

In my use case, I'd like to take my Drupal 7 contrib module for Joyride tours to function in a similar way to what is being developed for core in Drupal 8: #1809352: Write tour.module and add it to core

markwk’s picture

Ok. Here is my hackish workaround to get it to add joyride tour link: https://github.com/markwk/tour_navbar.

jessebeach’s picture

Status: Needs review » Postponed (maintainer needs more info)

The menu links should really be altered through the administration UI. This module is just pulling in the administration menu.

What else would you want to do to the links that a hook would be needed?

shadcn’s picture

My use case was: using a different menu (not administration menu) as the navbar.

Navbar

markwk’s picture

I'd like to be able to have my module create a menu item in the top. In my specific use case, it would be a "start tour" link like you see in Drupal 8. I'm guessing other modules might was to add different stuff. I don't see this as needing a full UI for adding links.

jessebeach’s picture

Status: Postponed (maintainer needs more info) » Postponed

markwk, ah, I understand! We're working on those two features in D8.

#1939884: Make the administration menu in the toolbar plugabble: don't hardcode to the 'admin' menu
#1894964: Make the Toolbar PHP and JavaScript API more flexible so that it enables contrib to leverage it

For D7, though, much of that easy click-and-configure type interaction might not be possible or backported because we'll be leveraging systems in D8 that just don't exist in D7. I would be open to folks proposing patches to this module to recreate that behavior in a D7 way.

Otherwise, Navbar provides a hook_navbar hook that provides a means to place tabs in the toolbar and a hook_navbar_alter hook to change existing toolbar items before rendering.

jessebeach’s picture

Issue summary: View changes
Status: Postponed » Closed (works as designed)

All of the use cases in this issue are addressable through existing functionality.