Questions tagged [navigation]

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

Filter by
Sorted by
Tagged with
-4
votes
0answers
20 views

How can I place a search bar in the header in the same column

I placed a search box in the Navigation (Collapsible) region of the Bootstrap theme. I wanted to set every block on the same column of the navigation bar. How can I customize the search bar? Which ...
0
votes
1answer
27 views

Hash in menu item url are removed when displaying the menu on a page

If a menu item has a submenu and I specify the hash symbol (#) in the Link field of such parent menu item in the admin panel, I receive empty url at the frontend and therefore if click by such link, I ...
0
votes
1answer
23 views

The "is-active" class is added to the main-menu links only when the site is accessed by an anonymous user

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
1answer
36 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 /...
1
vote
1answer
16 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?
0
votes
0answers
14 views

How do you batch process a path alias change for nodes that includes a menu placement change?

We have an annual reporting sites that contains approximately 200 nodes each year. When the next year's reports are complete, all of the current year's nodes move to a path like /archives/fy2020/*. ...
0
votes
0answers
36 views

Scientific taxonomy tree using taxonomy

I'm looking to create website that has a functional scientific taxonomy tree. There will be about 2000 species that span hundreds of genus and many families, classes, orders, subphylum and phylum. ...
0
votes
1answer
18 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 ...
2
votes
1answer
33 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. ...
1
vote
1answer
39 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 ...
0
votes
0answers
47 views

How to receive menu items in Twig template as array/object?

I need to receive (for example by menu machine name) and operate menu items data to use it in Drupal Twig template like: <ul> {% for item in items %} <li><a href="{{ item.url }}...
1
vote
1answer
33 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 ...
0
votes
1answer
28 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 ...
0
votes
0answers
41 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 ...
-1
votes
1answer
30 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?
0
votes
0answers
20 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->...
0
votes
0answers
37 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, ...
0
votes
0answers
17 views

Recreate the Management menu during migration

I've just done the upgrade from Drupal 7 to 8 (on a site that was updated from Drupal 5 to 6, 6 to 7...) and the management menu seems to be a bit of a mess. An attempt at trying to fix it up left it ...
0
votes
0answers
25 views

Menu link Converting full URL to local

When I save a menu link pointing to a node (nid 5, alias /woohoo/magic/test, it's value in the database is: entity:node/5 I'm trying to convert fully formed user inputs such as "http://127.0.0.1:...
0
votes
0answers
14 views

Large menu management options

I have a site with about 800 pages in the main menu. When creating or editing a node, managing the menu item parent can be challenging with a select list containing so many options! I am using Big ...
0
votes
0answers
33 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 ...
1
vote
1answer
64 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 ...
1
vote
1answer
27 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 ...
0
votes
0answers
15 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 ...
0
votes
1answer
18 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 ...
2
votes
1answer
62 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 = ...
0
votes
0answers
21 views

Inject a custom menu to the Administration menu

In Drupal 8 I would like to inject a menu at the first position of the Administration menu So that an editor can create a navigational structure for all users. So I would create a "Custom Admin ...
0
votes
0answers
34 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,...
2
votes
0answers
25 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 ...
1
vote
0answers
21 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 ...
3
votes
0answers
48 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[] ...
0
votes
0answers
26 views

How to make simple dynamic menu item?

I would like to move edit, delete, revisions etc. functionality of the current node from tabs above the node to the Tools menu. Is it possible to create menu link in form [current node]/edit, [current ...
0
votes
0answers
17 views

How to create a primary tab that links to the first accessible seconday tab?

In D8, for primary tabs that are local tasks an explicit route is defined. If the route is not accessible to the current user, the primary tab is hidden. Typically the same route is used again in a ...
1
vote
2answers
57 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....
0
votes
0answers
25 views

how to get the expanded menu tree of a menu link?

I have the following menu items - Menu item 1 -- Menu item 1 child - Menu item 2 - Menu item 3 -- Menu item 3 child - Menu item 4 I have the id of the Menu item 3 like menu_link_content:bda6f3cc-...
0
votes
0answers
18 views

How to display the child menu items in a select list?

I want to display the menu items in a select list. $items = \Drupal::service('menu.parent_form_selector')->getParentSelectOptions('main:', ['main' => 'Main']); It gives the following select ...
0
votes
1answer
73 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 ...
0
votes
0answers
12 views

Menu Link to views with % in URL

i have the following construct that i have the following URL: /node/nodeid/fooobar Foobar is a view that uses CONTEXTUAL FILTERS to draw the node id and then render the view. This works really well so ...
0
votes
0answers
14 views

"Content"- Section in Backend cannot be displayed after installing translation module (German)

after clicking on the "Content"-button (=Inhalt) there is an error displayed. I am not able to enter the "conten" Section of my Drupal 9 backend. This happened right after I ...
0
votes
1answer
36 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&...
0
votes
1answer
64 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 ...
0
votes
1answer
80 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 ...
0
votes
1answer
36 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 ...
0
votes
0answers
76 views

How to organize the summary of a book?

I created a book with the module provided by Drupal 8, but I am unable to organize the pages of the book correctly in a view. I want to organize the book in this way. In the left block, pages and sub-...
0
votes
1answer
42 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 ...
0
votes
0answers
26 views

Adding custom module path to admin menu

I created a custom module with a configuration settings page. It works fine, but I can't get it to show up under the admin configuration menu. I think the problem is I specified system....
1
vote
3answers
60 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, ...
2
votes
2answers
129 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?
1
vote
1answer
18 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 ...
0
votes
0answers
31 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 ...

1
2 3 4 5
32