Questions tagged [navigation]

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

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

How to unfold the main menu on Olivero?

I have a web site with Drupal 9 and the Olivero default theme. I created submenus in the main menu. On desktop no problem, but when the header goes into mobile mode, I want the menu to display the ...
user avatar
  • 1
1 vote
1 answer
27 views

Persist query string arguments across all links in a particular menu?

I have a menu "Display Style Switcher" which has two links: Map, and List. You click Map, you get the Map display of search results, and if you click List you get the list display of search ...
user avatar
0 votes
0 answers
28 views

Get link value from menu link

Let's say I have created a new menu node under Structure -> Menu. The name of the menu is "Footer" and for this I created a new "Menu link" called "imprint" which has ...
user avatar
  • 1
0 votes
0 answers
13 views

How to add a top-level link to the Admin menu via the links.menu and routing yaml's

Let's say I want to add an additional link to the admin toolbar after Reports such as Groups does. In my_module.routing.yml I have: my_module.admin: path: '/admin/my_module' defaults: ...
user avatar
1 vote
1 answer
26 views

Problem with auto-generated url alias when attempting to make a third-level menu item

Using [node:menu-link:parents]/[node:title] as the pattern for nodes in Url Aliases works fine for a menu that is only two levels, but if I attempt to assign a node to a third level under a menu, ...
user avatar
0 votes
1 answer
20 views

How to hide / modifiy ['operations']['#links'] edit / delete under structure -> menus in D8

I am trying to hide the edit and eelete links in the operations menu under structure -> menu for specific roles. I was just trying to hide the operations dialog at all by this code but it returns ...
user avatar
  • 281
0 votes
1 answer
36 views

Update menu links based on the site URL

I have URLs defined in links.menu.yml file as "route_parameters: {webform: 'abc'}", but I need to update webform value based on the page URL. If URL has "/type1/" in it, keep ...
user avatar
  • 113
0 votes
1 answer
28 views

theme_preprocess_menu is not seeing main menu

Background: I have an event website where I want to hide the event registration menu item when registration for the event is closed. theme_preprocess_menu is not triggering on anything except '...
user avatar
1 vote
1 answer
98 views

MenuLink vs MenuLinkContent - what's the point?

I'm struggling to figure out relationship between MenuLink and MenuLinkContent. I'm creating new menu item like: $menuItem = MenuLinkContent::create($params); I can also query those elements like: $...
user avatar
  • 375
0 votes
0 answers
34 views

Change breadcrumb title based on a node field?

I am using the Menu Breadcrumb module to automatically generate a breadcrumb based on the menu placement of the currently viewed node. I want to change some of the titles in the breadcrumb chain based ...
user avatar
  • 26.5k
0 votes
2 answers
35 views

Change default user tab

After logging in, users would be redirected to their user profile page. I have added a new tab, My dashboard using hook_menu(). Everything functions well. After the users log in, I would like they are ...
user avatar
  • 41
0 votes
0 answers
46 views

Disable "Edit" button for parent menu items

Is there a way to disable the edit button for parent links only? We want our content editors to only be able to edit the child menu items. We are using the latest version of Drupal 9. Thanks in ...
user avatar
  • 60
-1 votes
1 answer
21 views

hook_menu() items disappeared and no longer work

I'm feel like I'm losing my mind here. I have written a custom module and implemented hook_menu to add custom admin pages. Last week this worked perfectly - this week they stopped working then ...
user avatar
  • 1
0 votes
0 answers
38 views

Set URL alias for dynamically created menu links via MenuLinkContent::create [duplicate]

I am creating a menu link via the MenuLinkContent::create method as follows: MenuLinkContent::create([ 'title' => $createdNodeTitle, 'link' => ['uri' => "entity:node/$createdNodeId&...
user avatar
  • 263
1 vote
0 answers
26 views

How can I delete bogus links under /admin/structure?

I am running Drupal 9.3.4. I see four bogus links under /admin/structure. See the screen shot below. These were paths used by the Context module that were deleted. They are no longer listed under /...
user avatar
1 vote
1 answer
139 views

Dynamic language links from menu?

I am trying to find a way to do the following: Add languages to Drupal 9 menu items Translate content/menu links Provide (from the Main Navigation) a list of languages the current page is translated ...
user avatar
  • 26.5k
0 votes
0 answers
16 views

Can you add a node's translation to a different menu that the source node?

I would like to add a node's translation to a different menu than the node's source. Is that possible? For example, English is placed in main menu and french translation is placed in a different menu.
user avatar
  • 23
0 votes
0 answers
96 views

How can I remove or rename tabs from the 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 ...
user avatar
0 votes
1 answer
21 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 ...
user avatar
  • 819
0 votes
1 answer
33 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....
user avatar
  • 31
0 votes
0 answers
15 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 %}...
user avatar
2 votes
0 answers
50 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 ...
user avatar
  • 281
0 votes
1 answer
40 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 ...
user avatar
  • 133
0 votes
1 answer
47 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 ...
user avatar
  • 399
-1 votes
1 answer
54 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-...
user avatar
0 votes
1 answer
104 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 ...
user avatar
  • 459
0 votes
1 answer
192 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,...
user avatar
  • 1,710
0 votes
2 answers
93 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 ...
user avatar
  • 123
0 votes
1 answer
66 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....
user avatar
  • 21
1 vote
1 answer
64 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 /...
user avatar
  • 451
1 vote
1 answer
20 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?
user avatar
  • 1,359
0 votes
0 answers
16 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/*. ...
user avatar
  • 451
0 votes
1 answer
72 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 ...
user avatar
  • 1,939
1 vote
1 answer
52 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. ...
user avatar
  • 323
0 votes
1 answer
97 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 ...
user avatar
0 votes
0 answers
500 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 }}...
user avatar
  • 123
1 vote
1 answer
194 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 ...
user avatar
0 votes
1 answer
35 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 ...
user avatar
  • 605
0 votes
0 answers
53 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 ...
user avatar
-1 votes
1 answer
32 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?
user avatar
0 votes
1 answer
200 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->...
user avatar
0 votes
0 answers
42 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, ...
user avatar
  • 198
0 votes
1 answer
101 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 ...
user avatar
  • 47
1 vote
1 answer
409 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 ...
user avatar
  • 198
1 vote
1 answer
81 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 ...
user avatar
  • 11
0 votes
0 answers
31 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 ...
user avatar
0 votes
1 answer
168 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 ...
user avatar
  • 163
2 votes
1 answer
213 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 = ...
user avatar
0 votes
0 answers
46 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,...
user avatar
  • 177
2 votes
0 answers
29 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 ...
user avatar

1
2 3 4 5
32