Questions tagged [navigation]
Use it for questions about navigation menus and links used in a site.
1,605
questions
0
votes
1
answer
67
views
Finding all nodes not referenced by a menu
I see this question was asked for Drupal 7, but the menu_link table doesn't exist in Drupal 9.
Is there a SQL query for listing all nodes that are not assigned to a menu?
2
votes
2
answers
75
views
How to show menu tab only for certain node type?
I have the following,
In the routing.yml
mymodule.cache_clear:
path: '/node/{node}/cache'
defaults:
_form: '\Drupal\mymodule\Form\APICacheClearForm'
_title: 'Cache Clear'
requirements:
...
0
votes
1
answer
29
views
How to get translated menu link entity
I have a headless Drupal 9 solution and I'm currently working on i18n of the whole site.
I've managed to do everything except menus. The content translation core module is installed and setup ...
1
vote
1
answer
46
views
Custom Menu Template not Rendering Menu Links
I'm building a custom module that modifies the main theme (barrio bootstrap in this case) to establish a landing page. In that process, it hides blocks in some regions and takes over rendering the ...
0
votes
0
answers
18
views
Group and Group content menu
I'm trying to display menu from Group page. All is ok with the module Group content menu.
But when I'm trying to display the same menu on a subpage of the Group, there is no menu as if the context is ...
0
votes
0
answers
38
views
Menu links to media library items
Is it possible to link to media library items such as documents and images rather than be restricted to content nodes?
Fairly new to Drupal development and thought this would be fairly standard but ...
0
votes
0
answers
29
views
How can I extend the maximum number of items in a menu?
I maintain a website where a particular content type is always displayed with a left-hand navigation menu present. As part of the process for adding new content of this, the site editors add a link to ...
0
votes
2
answers
111
views
menu.tree_storage service is missing from my site
I have upgraded my Drupal 9 site to Drupal 10.1.
One of my custom module uses \Drupal::service('menu.tree_storage')->loadByProperties(); which works fine in drupal 9.5.9, but I get the following ...
0
votes
0
answers
32
views
How can I show the "content" menu without the "Access the Content overview page" permission?
On a site, I installed the Media and Microcontent modules. I need to set up two user roles, one which should access only the "Media content overview" page and the other one which should ...
0
votes
1
answer
97
views
How to get a menu link UUID from a menu tree item?
I'm trying to create a select box like the one that allows the selection of a menu parent on the node form. I might be barking up the wrong tree in my approach. I figured if I can get an array of menu ...
0
votes
1
answer
86
views
Turn off caching for local tasks menu
I have a somewhat complicated view that uses multiple displays for showing events. It uses a datepager (https://www.drupal.org/project/date_pager), exposed filters (using better exposed filters), and ...
0
votes
1
answer
27
views
Can I add classes to individual menu links?
I am using the main menu /admin/structure/menu/manage/main
There are a couple of links that I want to display only in mobile devices, and then also another couple of links that I want to display only ...
0
votes
0
answers
12
views
Menu from Views page display using contextual filter taxonomy term
Classified ads site here, Drupal 10.0.7
I have a View page display showing fields from nodes using Taxonomy Term Id as Contextual Filter.
So if the URL reads "[domain]/clasificados/8" it ...
0
votes
0
answers
59
views
New pages not included in main navigation but display in sidebar
I have recently inherited this website and was made aware of an issue where new pages that are added to the main navigation are only displaying in the sidebar. I have followed the steps for adding ...
0
votes
0
answers
29
views
How do I link to a Views Page from a systemAdminMenuBlockPage page?
I have a custom module that I have a systemAdminMenuBlockPage in that I'd like to link to various content administration Views pages from. I basically have a custom Configuration menu item doing this ...
0
votes
0
answers
41
views
Retrieve the name of the menu that a menu link is in
Given the code below i can get the menu link of the current page. What id like to know is how to determine what menu that link resides in.
$current_path = \Drupal::service('path.current')->...
1
vote
1
answer
239
views
How do I import/export menus?
I want to import/export all menus of site1 in into site2. Currently I am using the entitysync module to synchronize the content between two sites. I can see there is an option for "Custom Menu ...
0
votes
0
answers
46
views
Custom menu that handles content type creation
I'm a Drupal 9 newbie, and right now I'm on steep side of the learning curve.
I apologize if my question is a bit messy and long. Please bear with me.
I'm on Drupal 9.4.8 with a Bootstap 5 theme.
I'm ...
0
votes
1
answer
33
views
Add theme suggestion to a node depending on the menu it belongs to
I have a mega menu that displays child menu items when you click on a parent menu item in form of a drop-down menu. The thing is that, this menu, also displays cards as nodes and I want to add a theme ...
0
votes
1
answer
26
views
Menu items are displayed differently
I have a multilingual page with the languages Spanish and English.
When I edit the menu items in the backend, my default or original language is English.
Now the menu links in this menu are always ...
0
votes
1
answer
750
views
How do I programmatically alter the links displayed in the main navigation menu?
The main navigation menu in the site I am currently working on has a lot of menus. I want to hide the disabled ones.
I figured out that it is rendered via the menu_edit_form form.
entity.menu....
0
votes
1
answer
349
views
How to get menu Attributes from a theme's preprocess function?
I am developing a theme and trying to send custom vars to a twig menu template (since it pulls data from config) and have a loop to add variables in preprocess:
foreach($attributes as $attribute => ...
1
vote
0
answers
31
views
How to disable menus from list of menus per role
I'd like to enable visibility per role of menus placed in /admin/structure/menu .
What I want is to allow, for each menu (Administration, development, Footer etc + custom menus), the possibility for a ...
1
vote
1
answer
287
views
How edit or alter the links in the secondary toolbar?
I'm on D9.3.x with Gin theme and Gin Toolbar.
I need to edit the link available in the secondary toolbar.
Namely, I'd need to hide the shortcuts link for everyone and hide the edit profile sub-link ...
0
votes
2
answers
710
views
Add target="_blank" in menu items (main navigation)
I use Drupal 8.9.3 with custom theme. I need to do a menu item on the main navigation who go on an external link.
I would like to add target="_blank" on this link, but I don't see where I ...
1
vote
1
answer
53
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 ...
1
vote
1
answer
381
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:
...
1
vote
1
answer
52
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, ...
0
votes
1
answer
77
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 ...
0
votes
1
answer
60
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 ...
0
votes
1
answer
372
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 '...
1
vote
1
answer
371
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:
$...
0
votes
2
answers
62
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 ...
-1
votes
1
answer
30
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 ...
0
votes
0
answers
40
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&...
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 /...
1
vote
1
answer
476
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 ...
0
votes
0
answers
525
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 ...
0
votes
1
answer
59
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 ...
-1
votes
1
answer
387
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
0
answers
44
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 %}...
2
votes
0
answers
142
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
1
answer
119
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
1
answer
101
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
1
answer
208
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
1
answer
348
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 ...
1
vote
1
answer
503
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
1
answer
494
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
1
answer
138
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 /...
0
votes
1
answer
39
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?