Skip to main content

Questions tagged [navigation]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
109 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 ...
Sam's user avatar
  • 819
-1 votes
1 answer
505 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....
Drazen's user avatar
  • 27
1 vote
0 answers
74 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 %}...
Morgan Tartreau's user avatar
2 votes
0 answers
169 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 ...
macbert's user avatar
  • 363
0 votes
1 answer
144 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 ...
May 's user avatar
  • 163
0 votes
1 answer
140 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 ...
pglatz's user avatar
  • 469
-1 votes
1 answer
306 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-...
MetalBearSolid's user avatar
0 votes
1 answer
432 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 ...
deelite's user avatar
  • 479
1 vote
1 answer
632 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,...
sisko's user avatar
  • 1,720
0 votes
1 answer
696 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....
Bradley's user avatar
  • 121
1 vote
1 answer
160 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 /...
shelane's user avatar
  • 511
0 votes
1 answer
41 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?
Interlated's user avatar
  • 1,423
0 votes
1 answer
378 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 ...
hotwebmatter's user avatar
  • 2,112
1 vote
1 answer
183 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. ...
GradoniusTheWise's user avatar
0 votes
1 answer
455 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 ...
Monster971's user avatar
1 vote
1 answer
867 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 ...
ilechcod's user avatar
  • 123
1 vote
1 answer
108 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 ...
Sebastian's user avatar
  • 635
0 votes
0 answers
173 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 ...
steevee666's user avatar
-1 votes
1 answer
47 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?
steevee666's user avatar
0 votes
1 answer
669 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->...
Usman Manzoor's user avatar
0 votes
0 answers
120 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, ...
Timmah's user avatar
  • 197
0 votes
1 answer
356 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 ...
xax's user avatar
  • 47
1 vote
1 answer
1k 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 ...
Timmah's user avatar
  • 197
1 vote
1 answer
516 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 ...
MzudemD's user avatar
  • 11
0 votes
0 answers
92 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 ...
Alberto Castillo's user avatar
0 votes
1 answer
757 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 ...
jfc's user avatar
  • 195
2 votes
1 answer
557 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 = ...
Владимир Помелов's user avatar
0 votes
0 answers
84 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,...
WRD's user avatar
  • 319
2 votes
0 answers
47 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 ...
GuyPaddock's user avatar
1 vote
0 answers
67 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 ...
mgoubert's user avatar
  • 377
3 votes
0 answers
540 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[] ...
Anton's user avatar
  • 283
1 vote
2 answers
591 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....
trojaxat's user avatar
0 votes
1 answer
130 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 ...
TomP's user avatar
  • 103
0 votes
1 answer
322 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&...
mixerowsky's user avatar
  • 1,581
0 votes
1 answer
363 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 ...
xax's user avatar
  • 47
0 votes
1 answer
151 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 ...
TomP's user avatar
  • 103
1 vote
1 answer
296 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 ...
mathen's user avatar
  • 21
0 votes
1 answer
133 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 ...
Tobias Krause's user avatar
1 vote
3 answers
103 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, ...
TomP's user avatar
  • 103
2 votes
2 answers
637 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?
Liam Morland's user avatar
1 vote
1 answer
22 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 ...
Mark Robbins's user avatar
0 votes
0 answers
32 views

Administration menu links are incorrect

I installed drupal 8 using composer, which installed at location /var/www/html/drupal8/web. I updated apache root directory to this location, which allows me to access the site at mysite.com (rather ...
justinwysong's user avatar
0 votes
2 answers
29 views

Build out a complete main nav menu for a module - not just adding one menu link

I've been finding a lot of info about how to add a menu link as part of a module. That works fine using the route/controller & links.menu.yml file. But I am now trying to figure out how to add a ...
HeneryH's user avatar
  • 33
1 vote
0 answers
73 views

Different node parent menu for per language

My struggle with Drupal 8 continues as I moved onto i18n settings. I've enabled and configured content translation and now I'm facing issue of menu displaying untranslated pages. Popular suggestions ...
Dominika's user avatar
0 votes
1 answer
619 views

How to define an internal link as parent in mymodule.links.menu.yml?

How do I create a menu link programmatically to a node that I can use as a parent for other links? In MYMODULE.links.module, I defined some links for my navbar: MYMODULE.parent-fruits: title: '...
Patrick Kenny's user avatar
0 votes
0 answers
91 views

Drupal 8 Menu Block is not showing in left region for dynamically created routing page

I created some menus under 'Main Navigation' and assigned into the side bar region. I selected the depth level starting from 2 to 4.(See the screenshot) The menu block is not showing for dynamically ...
Manikandan's user avatar
0 votes
1 answer
578 views

How to allow the translation of menu links provided by my_module.links.menu.yml

I have the Configuration Translation module installed in a multilingual site and I am able to translate any menu created with the UI.... This is fine!! I have a module which is creating some menus ...
Baud's user avatar
  • 542
0 votes
1 answer
345 views

How to add a field to menus?

I am trying to add an extra text field to the menu entity. My field is showing up and saving input but the input saves for all menus not just the one I entered the data for. This is how it is now: ...
Jordan's user avatar
  • 11
0 votes
0 answers
232 views

Token support on the menu link field

Is there is any alternative way to make token to work in the Drupal 8 menu link field other than Menu Token module. I want to use token to set as a default value when I am creating new menu, but if I ...
mathen's user avatar
  • 21
0 votes
0 answers
41 views

Views page menu shows up on all languages

I am working on a old website built on Drupal 6 which has two languages. There is a views on which I created a page for each language, but their menus shows up on both languages. I tried different ...
johnnyg0's user avatar

1
2
3 4 5
33