Questions tagged [navigation]
Use it for questions about navigation menus and links used in a site.
1,620
questions
0
votes
0
answers
16
views
Parent Link In Menu Keeps Resetting After a Draft Is Created
Since Upgrading from core 10.1.7 to 10.2.7, I've been encountering a strange issue on the site that I manage. After creating a draft of any page, the parent link drop down keeps resetting to [main ...
0
votes
1
answer
37
views
menu tree behaves differently on two differents sections
i'm maintaining a drupal i didn't developed. I fixed some issues in the menu template
(e.g. /themes/custom/{mytheme}/templates/menu--menu-{my-menu-name} )
this template is called at two places in the ...
1
vote
0
answers
30
views
How to add menu to a region when viewing a node revision?
We have a layout with the menu in a left 'sidebar' region. The menu opens to the correct parent item when browsing a node as it should.
When browsing the latest (or any) revision of the node, the menu ...
0
votes
0
answers
22
views
How to add taxonomy and menu to content Mirgation using migrate, migrate_tools, migrate_plus and migrate_source_html?
I am new to Drupal and Would really appreciate the help
I am importing html pages using migrate, migrate_tools, migrate_plus and migrate_source_html it is working but I would like to also populate the ...
0
votes
1
answer
47
views
Editing block to update/remove menu items
I am new to Drupal and I'm trying to fix items on a website, which have several blocks containing menu items. I don't want to delete the blocks, I just want to edit them to remove/update the menu ...
0
votes
0
answers
37
views
Overriden Book Navigation template is not showing for anonymous user
On Drupal 10, I have copied and modified the book-navigation.html.twig file to my custom subtheme "templates" folder (/themes/custom/my_subtheme/templates/book-navigation.html.twig).
This ...
0
votes
0
answers
28
views
nodeaccess hidden main menu navigation
I have enabled the nodeaccess module for my Drupal 10 site and trying to figure out how to display the site menu navigation for certain user roles. In Drupal 7, there was a module called Always ...
-2
votes
1
answer
228
views
Is there a Drupal way to make a menu horizontal and responsive and leveled (similar in style and behavior to a main navigation menu)? [closed]
I have added a menu to a block in a full width region but my problem is that this menu appears vertical and I didn't find a way in Drupal to make it horizontal, similar in style and behavior to a main ...
2
votes
2
answers
216
views
How can I invalidate the entire cache when saving menu item?
I use the Simplify Menu module. Since changes in the menu are not applied, I would like to clear the entire cache.
Unfortunately the following code does not work
function ...
0
votes
0
answers
62
views
How can I prevent Drupal's translation functionality from changing a menu's links?
I have an about page at /about and a Spanish translation of the page at /es/about.
However, when I visit /es/about, the links in my main menu all have /es prepended to the paths. How do I prevent ...
0
votes
1
answer
172
views
Hook for hiding menu links based on user access
I have a Drupal 7 module that uses hook_preprocess_menu_link() to hide menu links based on user access. I am in the process of migrating to Drupal 9, and it seems that hook_preprocess_menu_link() ...
0
votes
0
answers
28
views
Get current node url in a custom block [duplicate]
I'm trying to embed Discourse comments in Drupal, so I'm tryinig tu use this code snippet in a custom block :
<div id='discourse-comments'></div>
<meta name='discourse-username' content=...
0
votes
0
answers
15
views
Italics in Text Menu Field [duplicate]
I am building a menu that contains the titles of books. This would normally be coded as
<cite>Book Name</cite>
in html. The Menu Link Title portion of the menu is a Text field which ...
0
votes
0
answers
24
views
Tabs menu action when parameter is present
Building a module in Drupal 10:
The module consists of several pages. All of which are accessed by tabs. The tabs are the same set of tabs for each page within.
The second tab goes to a form for ...
0
votes
0
answers
77
views
Unable to add Menu Items due to IntegrityConstraintViolationException
Background
I recently encountered an error when I try to create a new menu item:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1364 Field 'parent' doesn't have a default ...
1
vote
1
answer
36
views
Include html entities in dynamic menu links
I implemented a class CopyrightMenuEntry extending MenuLinkDefault which provides a custom menu entry (without link) with the current year and the site name.
class CopyrightMenuEntry extends ...
1
vote
0
answers
116
views
Disable custom module Block Caching or force correct caching
I have build a custom module that builds out a list of child page links based on 'this' page's id.
Logged in it works as expected. But an anon user has problems which range from the block not showing ...
1
vote
2
answers
116
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
101
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
2
answers
497
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
282
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
1
answer
113
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
85
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
61
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
371
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
1
answer
453
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
353
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
121
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
108
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 ...
1
vote
1
answer
510
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
50
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
37
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
30
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
1k
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
557
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
44
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
590
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
1k
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
74
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
698
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
73
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
172
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
91
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
687
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
735
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
89
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
37
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
716
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 ...