Questions tagged [navigation]

Use it for questions about navigation menus and links used in a site.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

Drupal 9 - remove tabs from local tasks block

I'm using Drupal 9.2.6 with Group module and I want to remove some tabs from local tasks block and rename some of them. I've created the module and placed above code with hook_menu_local_actions_alter ...
0
votes
1answer
17 views

Primary tabs display differently for different roles?

In my Drupal 8 site (using the Seven theme), the primary tabs navigation are displaying differently for different roles. See screenshots below. It would appear that for the limited Editor role, it's ...
0
votes
1answer
17 views

Get class on item.below (child item of menu) inside <li> tag in menu--main.html.twig

Hi I can't insert class in child item of main menu and remove existing. Part of my code looks like this: {% for item in items %} {% set item_classes = [ 'menu-item-edot', item....
0
votes
0answers
11 views

Front menu not showing subitems

I've generated my menu based on the menu template from the stable theme {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} {% if items %} {% if menu_level == 0 %}...
1
vote
0answers
15 views

Disable the "Add Link" button in entity.menu.edit_form for certain roles

I'd like to hide the "Add Link" button in menu.edit_form for certain roles. Running dpm($form) for this form I can't find that button in there. In core there is menu_ui.links.action.yml with ...
0
votes
1answer
24 views

Is it possible to render a region in a menu template?

In my Drupal 8 theme I have a template called __menu.html.twig which gets called in my page.html.twig I am trying to render a region within the __menu.html.twig where I can place blocks. I have ...
0
votes
1answer
41 views

Show links for all the views in the administrator menu

With the admin toolbar enabled, one of the things I miss from Drupal 7 is hovering through the administrator menu on Structure >> Views and seeing a list of all views and being able to click on ...
-1
votes
1answer
27 views

anchor menu description under each menu in menu.html.twig

I am currently displaying the Menu "description" underneath each link using menu.html.twig. by doing this: {% if item.original_link.getDescription %} <span class="navigation__link-...
0
votes
1answer
41 views

Menu item extras field in page.html.twig

I need a background image per menu item. For this I'm using menu_item_extras. I added an image field to menu items. This field I'd like to use in page.html.twig. How can I use this field in this ...
0
votes
1answer
78 views

List all the nodes with the same menu parent ID

I have the following menu in my system. The parent menu-link connects to a node whose ID is 58. All the sub menu-links have a parent ID equal to 58. I need to find the main and the sub-menus using 58,...
0
votes
2answers
48 views

Hash in menu item url are removed when displaying the menu on a page

If a menu item has a submenu and I specify the hash symbol (#) in the Link field of such parent menu item in the admin panel, I receive empty url at the frontend and therefore if click by such link, I ...
0
votes
1answer
32 views

The "is-active" class is added to the main-menu links only when the site is accessed by an anonymous user [closed]

I use this simple template (menu--main.html.twig) to render the main menu I created. <ul> {% for item in items %} <li> {{ link(item.title, item.url) }} {% if item....
1
vote
1answer
48 views

Is there a way to disable the <nolink> option for menu links?

For our unified Drupal platform, we require all of our sites main menu items to be a page and any sub-pages to show a path following the parent menu item. So if "About Us" (with a path of /...
1
vote
1answer
17 views

How do I add items from from the user module to a menu?

How do I add the core user module links such as My account and Log out to another menu?
0
votes
0answers
15 views

How do you batch process a path alias change for nodes that includes a menu placement change?

We have an annual reporting sites that contains approximately 200 nodes each year. When the next year's reports are complete, all of the current year's nodes move to a path like /archives/fy2020/*. ...
0
votes
1answer
27 views

Template preprocess to generate Font Awesome markup for menu links

In Drupal 9, I need the ability to prepend Font Awesome icons to menu links. I have attached Font Awesome 5 JS and CSS assets to my theme via *.libraries.yml. If I open a menu link in the DOM ...
1
vote
1answer
39 views

Dynamically load the menu items created from the links.task.yml file

I need to programmatically load the links that are generated from my_module.links.task.yml on another page. My exact use case is that I have a set of links that are shown when viewing my node page. ...
0
votes
1answer
54 views

How to make a vertical menu properly?

Good morning all, Today I would like to ask a simple question about the menus. How do you make a clean sidebar that takes up the entire length of the page? In general, the themes offer only natively ...
0
votes
0answers
111 views

How to receive menu items in Twig template as array/object?

I need to receive (for example by menu machine name) and operate menu items data to use it in Drupal Twig template like: <ul> {% for item in items %} <li><a href="{{ item.url }}...
1
vote
1answer
59 views

Restrict Menu Item Visibility by Permissions

I have a module-generated menu (using yaml file) with 5 menu items. My requirements don't allow me to restrict menu item visibility by role because roles can be dynamically added. So I have to do this ...
0
votes
1answer
29 views

Set local actions - disabled/inactive

I am currently searching for a possibility to set an action to "inactive" depending on something. I have found the hook_menu_local_actions_alter(&$local_actions), but do not know how I ...
0
votes
0answers
44 views

How to replace the default page and tab of profiles in the user account?

I installed the "Profile" module on my "Drupal 9" website. When I create a profile type, the module automatically creates a tab in the user account for each profile type. For my ...
-1
votes
1answer
30 views

How can I re-organize the user account tabs?

I have a Drupal 9 site. I can't find how to rearrange or rename the user account tabs. How can I re-organize the user account tabs?
0
votes
1answer
69 views

Translating Menu Item Programmatically?

I have been trying to translate menu items programmatically but upon saving it just adds the english field value to all my translations. Below is the code I am trying to execute: if ($entity->...
0
votes
0answers
39 views

Create multiple Menu blocks from the same menu

In Drupal 7, the Blocks page contained a link for 'Add menu block', from where you could create multiple menu blocks of the same menu. In Drupal 8, menu blocks seem to be generated automatically, ...
0
votes
0answers
20 views

Recreate the Management menu during migration

I've just done the upgrade from Drupal 7 to 8 (on a site that was updated from Drupal 5 to 6, 6 to 7...) and the management menu seems to be a bit of a mess. An attempt at trying to fix it up left it ...
0
votes
0answers
30 views

Menu link Converting full URL to local

When I save a menu link pointing to a node (nid 5, alias /woohoo/magic/test, it's value in the database is: entity:node/5 I'm trying to convert fully formed user inputs such as "http://127.0.0.1:...
0
votes
0answers
15 views

Large menu management options

I have a site with about 800 pages in the main menu. When creating or editing a node, managing the menu item parent can be challenging with a select list containing so many options! I am using Big ...
0
votes
1answer
61 views

Using TB Megamenu, how to close one submenu when I open another submenu?

I'm building a couple of (Drupal 8.9.13 and Drupal 9 based) sites where I use TB Megamenu megamenu module (https://www.drupal.org/project/tb_megamenu) to create the menu. All is working fine on ...
1
vote
1answer
199 views

Create a View Block that shows a taxonomy vocabulary applied to the current node

I have a news section of a Drupal 8 website that contains an ever-growing list of nodes. To avoid a messy menu in the long term, they do not have a menu position assigned but instead are shown via ...
1
vote
1answer
27 views

Disable menu link for certain languages

I'm looking for a way to disable a single link in a menu for a certain language. From my understanding with similar issues, I'd like to activate translation for the menu link field Enabled since this ...
0
votes
0answers
21 views

Add Image to parent item smartmenus

I have created a dropdown menu using smartmenus module, now I've got a design request asking me to add an image to each parent item. Here's the idea: My first approach was to try with Menu Items ...
0
votes
1answer
46 views

Sub Menu items not showing

I am trying to create a navigation with a sub-menu in Drupal 9. I added the top level nav item with and used # as the value for the link, and checked "Show as expanded" Then I created a new ...
2
votes
1answer
123 views

How to properly check the menu for emptiness in twig?

I use Simplify Menu to display the necessary menu markup. How do I make sure that the menu is not empty (there are items there) and if there are menu items, they are enabled? {% set items = ...
0
votes
0answers
22 views

Inject a custom menu to the Administration menu

In Drupal 8 I would like to inject a menu at the first position of the Administration menu So that an editor can create a navigational structure for all users. So I would create a "Custom Admin ...
0
votes
0answers
40 views

How would I create and render, but not save, an entire menu tree programmatically?

I'm trying to pull a number of links from several services, and combine them into a renderable menu tree: Source one: pull links A, B and C Source two: pull links D and E Source three: pull links F, G,...
2
votes
0answers
28 views

At creation time, why are shortcut titles translated, but menu link titles are not?

The idiom that the community points to for creating menu links usually looks like this (from \Drupal\Tests\language\Functional\LanguageSwitchingTest::testLanguageSessionSwitchLinks()): // Add a link ...
1
vote
0answers
24 views

systemAdminMenuBlockPage callback not respecting menu link permissions

I added a custom permission on "admin/commerce/config" to disable access for certain user roles. class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ public ...
3
votes
0answers
75 views

Menu link tree only loads enabled elements in subtree regardless of parameters

When loading a menu tree without any custom parameters: $tree = \Drupal::menuTree()->load('my-menu-name', new MenuTreeParameters()); The returned tree \Drupal\Core\Menu\MenuLinkTreeElement[] ...
0
votes
0answers
29 views

How to make simple dynamic menu item?

I would like to move edit, delete, revisions etc. functionality of the current node from tabs above the node to the Tools menu. Is it possible to create menu link in form [current node]/edit, [current ...
1
vote
2answers
106 views

How do I programmatically fix local menus to be shown only for a content type?

I am using the following lines in a links.task.yml file. x.nodename_updates: route_name: view.great_view_name1.page_1 base_route: entity.node.canonical title: 'Updates' weight: 50 x....
0
votes
1answer
80 views

Replace UID in view tab with name on user profile page

I'm working on a Drupal 8 site. I made a custom page view displaying special content created by the user. The menu tab shows on the user profile correctly by using Pathauto to show the correct address ...
0
votes
1answer
50 views

Additional attribute for menu link

How I can add itemprop="url" for each link (<a>) in main menu? So, I need to get from <a href="/node/114" data-drupal-link-system-path="node/114">Test</a&...
0
votes
1answer
101 views

<nolink> top items rendered as <a> and remain clickable (give page refresh)

I have a TB megamenu (8.x-1.x-dev) with a few top-level (parent) items that are not links, they should just trigger the submenu to drop down. According to the documentation I could find, links marked ...
0
votes
1answer
92 views

Hiding a tab on a user profile based on the user role

I'm making a site using Drupal 8 and I have several roles defined, one of them is Writer. I made a view to show as a tab in the user profile pages called Backlist. If the user is a writer, they can ...
0
votes
1answer
39 views

Menu setting not visibile for other roles on Node Form

In Drupal 8 I am creating Editor role with limited access, but the Editor cannot see "Menu Settings" while creating or editing content, this would be helpful when Editor add the node to the ...
0
votes
1answer
52 views

Tabs: invalidating cache tags does not lead to a rebuild of the tabs

I have a custom route defined with a custom access check. Apart from some more checks one of the rules for accessing the path is that a specific custom entity exists. The access check does the ...
1
vote
3answers
68 views

Custom Module to remove User Menu Tabs

I'm hoping someone can take pity on me because I just can't seem to figure out how to make a simple module to remove, or hide some tabs in my user pages. I read the docs on making custom modules, ...
2
votes
2answers
175 views

What is the replacement for menu_link_load()?

Drupal 7 has menu_link_load() to load a single menu item. What is the Drupal 8 equivalent?
1
vote
1answer
18 views

Some pages hide content unless "Read more" is clicked

If I have multiple pages on Drupal, some show the full page, and others say "Read more" and will only show the whole page when it is clicked. It doesn't seem to have anything to do with the ...

1
2 3 4 5
32