Limit the appearance of a menu

Dear colleagues,
Could you please let me know if it is possible to limit the appearance of a menu as we can do for a block? Can I choose to which users the access of a menu can be given?
To be more specific, I want to add in the main menu bar (about, groups, safety …) another menu (BEMB restricted) that will be visible only to the BE management. https://test-drupal8-beams-el.web.cern.ch/home

Many thanks in advance for your help!
Best regards,
Efthymia

Hi @eladeri,

The short answer is: if you put access restrictions in the nodes linked by the menu, the menu items will be visible only to persons having access rights on the linked nodes.

At least this was the default behaviour in Drupal 7.

You can try that first, and if it doesn’t work then maybe there’s a module for that :+1:

Hope this helps!
Regards,
Óscar

Hello Oscar,

Thanks for your fast reply.
It probably works if the links are to restricted Drupal nodes, but not to restricted external pages. That’s why we need the restriction on the block (or menu, which in the end is a block…).

Could you help with this one?

Many thanks,
Efthymia

Hey @eladeri,

To be honest trying to hide links that redirect to external websites is a quite specific requirement and doesn’t make much sense. They are public websites, why would you want to show/hide them? As @ogomezal already mentioned, Drupal has the mechanism to automatically show/hide internal pages to only people that have access to them.

Now if you want to create a “Useful Links” menu block, my suggestion would be the following.

  1. Create a menu (better not use the Main Navigation one)
  2. Add the external links in the menu
  3. Place the menu in your pages using the Block Layout interface. I would propose to place it either in one of the sidebars or in the footer. When you place the menu block you can choose to restrict the menu to specific roles

Let me know if that works for you.

Kostas

1 Like