Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [navigation]

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

2
votes
0answers
29 views

How can I translate the 'enabled' Boolean of menu items?

I'm trying to translate the 'enabled' field of a menu item in Drupal 8. So far I have written this code in mymodule.module file: function mymodule_entity_base_field_info_alter(&$fields, \Drupal\...
0
votes
1answer
11 views

How do I turn off mobile menu collapse for bootstrap 3 theme in drupal 8?

I am looking to use a different mobile menu solution and replace the default bootstrap 3 mobile menu. How can I turn off the bootstrap collapsed mobile menu function?
1
vote
1answer
20 views

Is the homepage considered in_active_trail?

I'm learning Drupal 8, so still very new to it. I'm working on customizing the main menu. I've been able to add Twitter Bootstrap to my custom theme. I've made a custom menu--main.html.twig file. I'...
0
votes
0answers
34 views

Display another page's content without changing url for drupal 8

I want to display another page's content without changing url for drupal 8 . In drupal 7 I used menu_execute_active_handler() , but drupal 8 this function is not available. I got a solution from ...
0
votes
1answer
7 views

What is needed to keep parent menu element active while browsing subpages (Bartik Theme)

Let's say we have 2 sections with pages like this structure: /section1 * /section1/page1-1 ** /section1/page1-1/page1-1-1 ** /section1/page1-1/page1-1-2 ** /section1/page1-2 ** /section1/page1-3 ** /...
0
votes
1answer
66 views

Error when upgrading to Drupal 8.7.1 on module menu_link_content

When running database updates (on domain.com/update.php) from 8.6.15 to 8.7.1, I got the following error: module menu_link_content Update make_menu_link_content_revisionable Custom menu links have ...
0
votes
0answers
13 views

Using Layout Builder With Menu Items

I recently just updated to 8.7 and for the most part everything is working well. In my dev environment I was working on a new feature using layout builder with menu_item_extras to apply a layout to ...
1
vote
0answers
25 views

Menu item URL not updating using MenuLinkManagerInterface::updateDefinition()

When trying to update an existing menu link URL/ URI with updateDefinition() - https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21MenuLinkManagerInterface.php/function/...
0
votes
0answers
21 views

How to limit the number of top level menu items

I have a horizontal top level menu and only room for 7-8 links without breaking the layout. Is there a way limit the number of top level menu items? I found an old answer to the same question on ...
0
votes
1answer
53 views

How to add a nolink menu item

I'm creating a menu item for my main navigation bar. It looks like this: module/module.links.menu.yml: top.link: title: 'Operations' description: 'Operations' parent: main menu_name: main ...
0
votes
0answers
9 views

Change maximum depth of a menu tree

I discovered today that Drupal 8 only allows you to add menu items in a maximum of 9 levels. I understand this is more than enough for most users, but I'm using the menu system to organize pages for ...
-3
votes
0answers
20 views

Class 'Drupal\Tests\Core\Menu\MenuTreeParametersTest' not found in “My Block”?

how to fix this ? drupal version 8.6.15 and php 7.2 . error : Class 'Drupal\Tests\Core\Menu\MenuTreeParametersTest' not found in "My Block" ? my code : function menuAccount() { $tree = \...
0
votes
1answer
31 views

Submenu tree problem

I have a website build with Drupal 7 CMS and I am using the Submenu tree module. Everything was working fine for months, but few weeks ago I have received a feedback from the client that all the links ...
1
vote
1answer
12 views

How do I add an extra “Add content”-link to the admin toolbar dropdown

I am trying to add some improvement to the workflow of the webmasters. Right now they have to click "Content", and then click once more on the "Add content" button. Since I am working with the "Admin ...
0
votes
0answers
10 views

Menu link title used as page title on first access

Simple problem: I defined some main menu links under /admin/structure/menu. Whenever i access the linked page, the page title shows the menu link title and not the title set in .module. Every access ...
0
votes
1answer
12 views

main menu disappears only on home page

I have a site online engcorrect.net and for some reason my menu on my homepage disappears. On all other pages, it shows. The weird thing is that on my localhost (local machine) it shows correctly but ...
0
votes
1answer
30 views

How to tell if a menu link is route:<nolink> or not?

Trying to theme a menu in Drupal 8, running into a case where we need to add classes on certain links. In the case of a menu link that is route:<nolink> we need to not add any class at all. ...
0
votes
2answers
56 views

Switch between View Modes from the URL

Under the manage display for the user profile /admin/config/people/accounts/display, I have 4 view modes as below: Default Profile (Machine name: user.profile) Company (Machine name: user.company) ...
0
votes
2answers
23 views

Is there a way to pass multiple arguments to menu_name while creating menu links programmatically?

Am using Drupal 7. Below is my code where am trying to create menu links programmatically: $links[] = array( 'menu_name' => 'management', 'link_path' => 'myheader/config', 'link_title' => '...
1
vote
0answers
36 views

Caching of sub site menus

Preamble We currently have a Drupal 8 site that has subsites (accessed via subdomains). On the main site (non-subdomain) we have a main navigation menu defined (this is presenting correctly on the ...
0
votes
0answers
26 views

Using Layout Builder with Menus

I followed this tutorial but am having some issues. I enabled menu_link_extras and layout_builder on my site. I enabled layout builder on my menu, added a menu link and added a block to that link's ...
0
votes
1answer
35 views

Menu on the taxonomy term page

maybe the solution to my problem is quite simple but I can not find a way on the taxonomy term page to show a menu block! I use drupal 8 with bartik theme and have a menu based on taxonomic terms (...
0
votes
0answers
14 views

Creating menu tabs in a child page

I have a suite of modules that go together, and they are all ideally housed under one parent item on the 'management' menu. The normal pages of these modules are correctly being placed under this ...
0
votes
1answer
16 views

Drupal 7 how to use item menu as MENU_LOCAL_TASK and MENU_NORMAL_ITEM simultaneous?

I have hook_menu with 3 pages they are defined by default as MENU_NORMAL_ITEMs and I see them from in main menu: $items['accounting'] = [ 'title' => 'Accounting', 'page callback' => '...
0
votes
0answers
15 views

How to add menu links to a dropdown programmatically

I have added a menu item to my Drupal website via the following: business_listing.links.menu.yml business_listing.listings: title: 'Browse Members' description: 'Browse Business Listings' ...
0
votes
1answer
23 views

Render a menu block in current user's language

I have a multi-language site. How this is supposed to work is that on /fr pages, everything except main navigation block should be in French. However, main navigation menu block should be in whatever ...
0
votes
0answers
13 views

Hide “empty” menu parents

I have the following scenario: I have a sidebar that contains my mainmenu. Menuparents are linked to route:<nolink>. Those parents can be expanded using superfish (accordion). When a user has ...
0
votes
0answers
62 views

Clean URLs for pager links?

I need to change the pager links from taxonomy/term/12?page=1 to taxonomy/term/12/page/1, in Drupal 8. I know about the Cleanpager module, but it works only in D7. Its development snapshot for Drupal ...
0
votes
0answers
23 views

Need to add custom block have previous, next and up links for book page

I am stuck in an issue where I need to create a side bar block on book pages. This block will contain links for: previous chapter, next chapter and up level. Tried searching on google. Also, tried ...
0
votes
1answer
20 views

Template suggestion don't work with a custom menu link (custom route)

In a module I have created a custom link by creating a custom route inside the mymodule.routing.file.yml and the mymodule.links.menu.yml file. In my theme.theme file I have defined a hook_page_alter ...
0
votes
1answer
9 views

How do I edit the links in a filter

I don't know if this is the right forum, but I'm updating our corporate website, and picking up where the previous person in my job left off. From the main horizontal menu on the front page (...
0
votes
0answers
23 views

How can I add custom field to menu block?

I want to display a menu in my theme with an editable background. So I'm trying to add a custom field of type image on my menu block. I tried via HOOK_entity_base_field_info but it seems that block ...
1
vote
1answer
23 views

Unclickable Menu link keeps refreshing my page

Hello and sorry for my bad English. I am using Drupal 8 and i want to make a menu with categories. The menu title has to be CATEGORIES and when someone click on it, the menu has to show the categories ...
0
votes
1answer
23 views

Why do my main menu tabs show up on two lines instead of one?

In Drupal 8, I have a main menu in the "Primary menu" block of the default Bartik theme. You can see a screenshot below. This site was upgraded from Drupal 7. Why does the menu show up on two lines ...
1
vote
1answer
90 views

Add icon to module's menu item in Administration menu

I've searched for a bit and I haven't found a solution to my liking: I want to avoid adding more modules to the project. I'm very new to Drupal, so I have minimal knowledge on that matter. I have ...
0
votes
0answers
12 views

User profile local task link

How can I create a link with comments/%user in the local task in user profile page for all users. This want to include it after the "Edit" and do it programatically in the .theme file. . If I try ...
0
votes
1answer
74 views

Hiding menu item depending on specific access

I work on a D8 (8.6) I want to hide some item on my menu depending on route param onto this link. When I try to access the route I get a 403 error and works as expected but the the link inside the ...
0
votes
1answer
36 views

Clear region with menu's per url cache

I have a region with menus, a menus displays depending on the url example if on the about page(sitename/about-us), display about menu and links as a sub menu. It works, but the problem is after ...
0
votes
1answer
53 views

How do I implement a one page navigation with anchors?

So the specific functionality I'm looking for is a link on one page (e.g. drupalsite/home) leading directly to a specific section of another page (e.g. a section on drupalsite/otherpage). I believe ...
1
vote
1answer
16 views

Navigation for book collections

I'm working in a projet where I have to show a collection of books. In this website I managed using the books navigation block, for one collection with many books, with css I managed to set a tree ...
0
votes
1answer
75 views

“Expand all menu links” Menu Block selection shows all menu items in block not just active trail items

I have a menu block that I have setup with Initial visibility level = 2 and Number of levels to display = Unlimited. When I check the "Expand all menu links" checkbox and view my menu block it is ...
-1
votes
1answer
27 views

dynamic drop down menu items

I'm new in drupal and I would like to add a link Projects to the main navigation menu: Projects proj 1 proj 2 ... proj n This link projects with a drop down menu with N links. Until now I ...
0
votes
0answers
32 views

Recurse through menu to check a field on the entity referenced by the menu item

working in Drupal 8 on a bit of an interesting concept. I want to be able to load a menu link on an entity provided by the module menu link (field). From there, I want to load the parent menu item ...
0
votes
0answers
39 views

How to change the icon classes using mmenu

I'm new to the drupal community, so I'm sorry if I make any mistakes in posting this question. I want to change the menu-item icons for the Mobile sliding menu module. I realize that my question is ...
1
vote
1answer
65 views

Add classes to the menu item <li>?

In a preprocess menu function(), I want to add custom classes on my li menu. For this I use this: $item['attributes']->addClass('section'); // or $item['attributes']->setAttribute('class', ...
0
votes
0answers
38 views

Rebuild menu after adding a menu item

I am migrating nodes from D7 to D8. For various reasons I am writing my own code to do this. The migration will run on a couple dozen different sites so the solution needs to be as generic as ...
2
votes
1answer
124 views

main menu link as language switcher

I have 2 language and these situation: main menu -> lang1 -> link to www.foo.com/ main menu -> lang2 -> link to www.foo.com/en All sites when switch manually on browser the language, But my main ...
0
votes
0answers
34 views

Redirect after saving referenced nodes

[Note, this question is almost identical to this one for Drupal 7, but since I never used it I cannot understand how the proposed solution can be ported to Drupal 8] I have a parent node type, let's ...
0
votes
1answer
74 views

Remove Home from menu at module installation

I can remove the "Home" tab from the main menu going to /admin/structure/menu/manage/main, but I would like to automate it so that it is done at module installation. I checked that the configuration ...
2
votes
2answers
177 views

Dynamic local tasks - caching problems

I try to create some local second level tasks depending on some settings for a custom entity. But unfortunately sometimes these local tasks do not appear - they appear again when rebuilding caching ...