Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300550

Menu link plugins should provide a way for the link to be conditionally hidden

$
0
0

AFAICT, there's no way for a menu link plugin to cause the menu link not to appear.

There is MenuLinkInterface::isEnabled(), but returning FALSE from that causes the menu link itself to become disabled.

I've also tried returning either '' or NULL from getRouteName(), but that causes a routing crash. There's route '<none>' but that creates a link to the current page.

At this point the only thing I can see to do is to create a custom route which always denies access, and return that route name.

Use case is that I am writing a custom menu link plugin to show a user's group. If the user has no group memberships, then the link should not show.


Viewing all articles
Browse latest Browse all 300550

Trending Articles