Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
14 views

Login/Logout link doesn't show up in main navigation

I have moved the login/logout and the my account link from the user navigation to the main navigation as of this post: How to add a Login / Logout link in Main navigation menu? Now the my account ...
0
votes
0answers
24 views

Why is menu_name in menu.twig null?

The first level prints the menu name but subitems do not. My menu.html.twig: {% import _self as menus %} {{ menus.menu_links(items, attributes, 0, menu_name) }} {% macro menu_links(items, ...
0
votes
0answers
21 views

Add class to UL in menu block if block has class

I have a menu that I am display in a menu block. I am using the Block Class module to add a class to my menu block. For example: I have a menu called "About Page Menu" that has 3 menu items. I place ...
0
votes
1answer
27 views

Sub-menu items in twig

How can I theme all the menu levels individually in menu.html.twig? I need to give different markup to the 2nd (child) and 3rd (grandchild) level, and in the twig I only have parent and child. {% ...
1
vote
1answer
19 views

How to prevent the conversion of text URL to link on a single URL?

I have a page that I am adding, and for my purposes I want to have a text-only URL without an automatic link, but only for that one link, one this specific page. I need to be able to add full html ...
0
votes
0answers
20 views

Tabindex -1 on admin form elements

Why in the world does D8 admin menu have tabindex -1 on every single form element?? Why would they make it so that I can't tab through any form element in the admin panel. Tab is now worthless for ...
1
vote
1answer
35 views

How to create menu overview?

I'm creating a custom menu in the administration for my module with multiple elements. This works fine by defining the forms, routes and menu links. How can I create a page like /admin/config for my ...
0
votes
0answers
27 views

How can I add an option to a menu

I would like to add an option (select) to a menu. I am using hook_form_menu_edit_form_alter to add a select element and an additional submit function. The select is shown and my submit function is ...
0
votes
0answers
24 views

How can I duplicate the auto-populating feature of the main navigation?

I'm trying to create a menu that is the same as the main navigation, but has its configuration tracked separately. This is important because there are some menu items on the new menu that I'd like to ...
0
votes
1answer
39 views

How do I add a link to the #title property of a checkbox?

I created a custom module for Drupal 8.6, and I want to post a link to my terms and conditions. This is the code I am using. namespace Drupal\commerce_agree_cgv\Plugin\Commerce\CheckoutPane; use ...
1
vote
1answer
30 views

Leaving first-level tab selected when clicking on a subtab

I have a menu like the following defined in mymodule.links.menu.yml: mymodule.page_memos: title: 'List of memos' description: 'View list of memos' route_name: view.document_list.page_1 ...
0
votes
0answers
26 views

Converting an entity with existing contents to revisionable throws exception

I'm trying to convert a core entity (menu_link_content) to revisionable with existing data. I'm trying to figure out how to accomplish this. I saw this go to guide here - https://www.drupal.org/docs/...
0
votes
0answers
25 views

How to change access for menu link by the user roles

I have a module for Drupal 8 that allow you to administer access to the node content by user role. I need the same solution for administer access to the menu elements - do you know any solutions? ...
0
votes
1answer
25 views

Sub menu or Drop down menu is not working

I have right and left navigation menu working in Drupal 7. I am trying to implement sub menu for one of the element of right navigation. Menu is working well. Somehow, sub menu is not displaying not ...
0
votes
0answers
27 views

How to output the same menu in another region and add another template for this instance

I'm using Drupal 8, I would like to use one menu and create another instance of this block to put it in the footer region. This wil result in only maintaining one menu instead of two.
0
votes
0answers
26 views

Wrap anchor links in button tags

it looks like this is the section that is drawing the navigation anchor links, I just want to wrap them in <button> <button/> tags, but I can't tell where to intercept the links? /sites/...
-2
votes
0answers
28 views

Multiple 'Register an Account' Menu Links Being Automatically Created

On my Drupal 8 website, I keep getting 'Register an Account' menu links, being automatically created in the User Account Menu. After a while, I then have to manually delete around 50 or more entries ...
1
vote
1answer
15 views

Generate menu links for a view with contextual filter and parameters in the path

I have a view with a contextual filter, and a few tabs corresponding to a taxonomy. In my module.links.menu.yml I have something like this: mymodule.apple_view: title: 'List of apples' route_name:...
0
votes
2answers
31 views

Security model and menu access

Drupal 8.6.1 I have some menu items I would like to hide from some users: An administration menu with documentation about site admin; A contributors menu with documentation for contributors. etc. ...
1
vote
1answer
39 views

Adding a flag to Menu Content Link to display as a non-link [duplicate]

I have been struggling/failing for the last day to try find a way that I can add a flag/marker to the Drupal menu links that I can examine within the menu TWIG template to modify the link such that it ...
0
votes
1answer
18 views

When does hook_menu run?

I need to edit the hook_menu function in my module. I need to add a new link to a menu, and edit the path for an existing link. Is this possible without creating a whole new module? The only ...
0
votes
1answer
20 views

Main Menu link to all newsletters and another for Articles

I am very new and not a developer. I would like to create two main menu links for newsletter content type (simplenews) and the core articles type. I want the behavior to be the same as blog. I ...
2
votes
2answers
64 views

Add Language Switcher on admin toolbar

What is the correct way for adding Language Switcher (Dropdown) or links on the admin toolbar menu from my custom module or from a contributed module?
0
votes
0answers
16 views

How can I add a form as an item of the main menu?

I'm working with the OpenID Connect module to connect a Drupal 7 site with an OpenID provider as a client. So far, I managed to get the module up and running, registering and logging users with my ...
0
votes
0answers
11 views

HTML 5 geolocation integration on GMap Module

I'm trying to use HTML 5 geolocation option with addressfield module. I have GMap, addressfield and addressfield_autocompleted modules installed. As per my understanding GMap have the option to use ...
0
votes
1answer
27 views

How to add another navigation bar/block at the top of your site?

I want to add a custom header/navigation block at the very top of my page like so, it's essentially a menu item. For example, it has two items: Home and Business. Once clicked it stays highlighted and ...
0
votes
1answer
23 views

TB Megamenu 3rd level does not expand

I'm using TB Megamenu on a D8 site. With a bit of tweaking all working fine.. However, when I try to have a third level of links I can't get this to show expanded. In the menu itself the level 2 item ...
2
votes
1answer
38 views

How to check “Show as expanded” by default on the Add menu item page

I need the 'Show as Expanded' checkbox on the Add menu item page to be selected by default. I created a module, 'expand_menu_items', and tried a hook_form_alter function to get the id, apparently it'...
1
vote
0answers
37 views

How create Menu items by permissions for a view page?

My client wants a menu with a link for each content type. Each item will displayed if the user have permission to create that content type. Each item will show a list of content only for that ...
0
votes
2answers
37 views

How to change theme template for the same block that is loaded twice on the page?

We have created two menu blocks: main_menu (region=main nav) and main_menu_footer (region=footer) that are added to all pages. They both are displaying the same main navigation menu except ...
0
votes
0answers
13 views

Custom menu item doesn't show up in admin menu bar for role

I have a D7 site using Admin Menu, and I have a URL defined in a custom menu that I want to display in the Admin Menu bar at the top of the page for two roles - Content Editor and Administrator. I ...
0
votes
1answer
62 views

Dynamically creating menu items

What I need is to add menu item to some menu, but it should have different parameters (title and url) depending on language. So I created new module and added links.menu.yml like: my_menu_item_id: ...
-1
votes
2answers
31 views

Add a svg icon before a link in menu YML

I've created a link menu and I want to add a SVG icon before it. This is my YML : double_vue_klesia.listeSwitch2: title: 'Double vue Klesia' route_name: double_vue_klesia.listeSwitch ...
0
votes
1answer
29 views

Inside drop-down menu child menus are not working

I am using bootstrap sub-theme and created a drop-down menu and set it's menu levels they are working correctly but when i extend to child menus it's not working. I have searched Expand menu links ...
1
vote
1answer
277 views

How to add an sms:number link to a menu?

In Drupal 8.5, when you're adding a menu item, you can add a telephone number by setting the Link to tel:1-555-555-5555. However, if you try to add an SMS link like sms:1-555-555-5555, it fails ...
1
vote
1answer
78 views

Adding onclick attribute to menu links

I'm trying to add the onclick attribute to some menu links in Drupal 8 in order to track conversions with Google. Here's a tutorial for adding onclick events in Drupal 7 that uses the Menu Attributes ...
-2
votes
2answers
23 views

Location based menu items

I have smart IP enabled in my site and is working fine. But there is no options to localise menu items based on IP. But I need IP based menu items. Is there any?Please advise.
0
votes
0answers
36 views

route:<nolink> looses styling and not working correctly in Superfish menu

I have set the parent item (reaching-out) on my main superfish menu as a "no link" item so that only the dropdown menu items link to pages. On doing so I lose my styling which is OK because somehow I ...
1
vote
0answers
193 views

How do I use the Bootstrap 4 mobile menu in a Drupal 8 theme? [closed]

I am trying to make a Drupal 8 theme from an existing HTML page. The page uses the Bootstrap 4 menu. I was able to get the normal version (desktop) of the menu working by copying menu--main.html.twig ...
0
votes
0answers
22 views

Option to limit menu depth?

Is there any option to limit menu depth similar to menu_depth_limit module in D7? Or any custom approach?
0
votes
1answer
272 views

Add .active class to a menu link when other menu link is clicked

I have following scenario: Drupal 8.5.6, with a bootstrap subtheme. There are 2 menus (I'll call them main menu and secondary menu). The links in the main menu are geographic areas, I've managed to ...
2
votes
2answers
139 views

How can I add a span tag inside my menu link?

My twig file contains the following: <li{{ item.attributes.addClass(classes) }}> {{ link(item.title, item.url) }} </li> Which outputs: <li class="menu-item item--search"> &...
0
votes
0answers
12 views

Copy Menu Items From Facet Menu to Main Menu

Working on Drupal commerce 2, I want to have product categories in my main menu as submenu items for which I first tried to use taxonomy menus but unfortunately default taxonomy results only works ...
0
votes
1answer
29 views

Per language menu item settings in node forms

I'm working on a drupal 8 website. On every node the admin can choose wether or not to show a node in the main menu, and where it should be placed. This works great with the menu settings node form ...
0
votes
0answers
16 views

Superfish Vertical dropdown on horizontal menu

I am using a superfish horizontal menu on a Drupal site that has a horizontal dropdown. How can I change the dropdown to a vertical one.
0
votes
1answer
29 views

How to add a block to a region in html.tpl?

I'm using Drupal 7. I have a custom template html--custom.tpl.php. I have a custom block that contains the main menu. This block is enabled in the header region of block admin. Up to this point, ...
0
votes
1answer
32 views

How on node forms do I show weight of all menu items?

I'm wondering how it is possible (with a hook) to show the weight next to the menu title in the parent drop down found in the Menu Settings tab. So this is what it is at this moment: And this is ...
0
votes
2answers
31 views

Non-breaking space in menu link name

How to put non-breaking space into a menu link name in Drupal 8? I tried &nbsp; but it got displayed   literally.
0
votes
1answer
34 views

How to move nested links in menu edition?

In Drupal 8 I created nested menu links. After some days I tried to move them. Eg. one nested link to one parent menu link but the moving got disabled. I remember that there were small cross icons ...
0
votes
1answer
82 views

Show/hide menu link based on changing custom $tempStore value

I'd like to show/hide a main-menu link based on a $tempStore variable the user can set and modify during their session, i.e. user sets $tempStore['vlaue'] = 0; --> menu link is hidden user sets $...