Questions tagged [navigation]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
432 views

Change Classes in Nav-Tag of Custom Menu

On a Drupal 8 installation, I have a menu in the sidebar first region. I want to add classes to bootstrap classes to the different levels of that menu. For that I created a my own menu template, which ...
1 vote
2 answers
391 views

login_destination module and link with anchor

I want to to use login_destination module to have a link to login screen in comment-wrapper.tpl.php, so after the login, the user came back to write the comment. I have installed and configured ...
1 vote
1 answer
83 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
483 views

Outputing the field as link doesn't properly show the field properties

I want to output an image field as a link in a view. I've seen many tutorials but get stuck at one point. I already added the link on top of the image field. By clicking on the image at rewrite ...
0 votes
1 answer
486 views

How can I increase the 128 character limit of a menu path?

I know there are patches to core, but they were never backported to Drupal 6 from what I can tell. Increasing path length to 255 chars Menu path length is limited by the UI to 128 characters How ...
0 votes
2 answers
2k views

How to add active class to title which is loaded via views in block

I have created content type XXX, via views I collected all titles of XXX content. That all titles works as links, I want to add active class to title which was clicked in block. It should works as ...
0 votes
2 answers
532 views

Filters as rewrite results link path parameters

I am currently using this approach to link lists view's rows to detail pages in Drupal 8 I would like to pass the entity title of the row to the receiving page and use that to select view blocks ...
1 vote
1 answer
1k views

Content edit links?

I'm new to Drupal 8 and can't figure out a way to show the edit contextual links for content displayed through the Views module. This was simple in Drupal 7, but in Drupal 8, a view only shows the ...
0 votes
1 answer
658 views

All added links open as target, how to prevent it?

In my Drupal based website, all links that I added from CKeditor open as (target="_blank" Link example: (<a href="node/add/name">Name</a>) After adding, example from html source: (<a ...
0 votes
2 answers
497 views

Multiple aliases per node (and active trail)

Our site is split down the middle for tenants and landlords. But we have content the is the same for both such as "how to report antisocial behaviour". User would normally navigate something like "...
1 vote
1 answer
723 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
1 answer
470 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
1 answer
510 views

Menu block makes parent menu item active when maximum levels not cover the linked node

In Drupal 7, a menu block can specify maximum levels. If the maximum levels is not enough to cover all menu items linked node, when in the not-covered menu items linked node, could menu be active at ...
0 votes
1 answer
720 views

Fatal error while editing and deleting menu items

Facing one issue in deleting the menu items on my Drupal 8 Site. Steps to reproduce: Add a link to main menu. Create Child terms under one link. Delete the parent term. After deleting the parent link ...
0 votes
1 answer
429 views

No working link to network files

For an intranet solution I would like to add a bunch of rather static links in Drupal to network files which change from time to time and are maintained by people not using Drupal. To achieve this I ...
0 votes
1 answer
409 views

View button that links to current node

I'm trying to create this button in my views with a custom text, that needs to link to the current node. I know you can use links and that works, but.. i need something like a variable that makes the ...
0 votes
0 answers
22 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
2 answers
820 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 ...
0 votes
0 answers
45 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
33 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 ...
13 votes
4 answers
27k views

How do I create menu links programmatically?

I need to add some links to existing menu (or to new) programmatically in Drupal 8.
13 votes
6 answers
5k views

How to display more than 10 items in link widget autocomplete?

This is a question about the Link module. Since with the Link module you can enter external or internal links both, we strongly rely on it. Unfortunately the number of items to be displayed from its ...
3 votes
2 answers
4k views

creating links containing anchors

In relation to Drupal 8 ... if a user wanted to create a link such as the following: <a href='#' onClick='testfunction ();'>link</a> How could such a link be created, normally creating a ...
0 votes
0 answers
39 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
160 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
109 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 ...
2 votes
4 answers
671 views

Add Language Switcher on admin toolbar

What is the correct way for adding Language Switcher (Dropdown) or links on the admin toolbar menu from my custom module or from a contributed module?
2 votes
1 answer
380 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
1 answer
29 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 ...
5 votes
5 answers
14k views

show/hide a menu item based on specific user role

I have a certain number of main menus which need to showcased based on logged in user role. for example user with the role, A can sees few menus and user with the role B, sees another set of few ...
4 votes
4 answers
3k views

Clearing local tasks cache

Using a deriver, I'm able to produce local tasks for each entity of my custom configuration entity type. So if I have two configuration entity labeled "Foo" and "Bar", I can have similarly labeled ...
0 votes
0 answers
15 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
1 answer
40 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?
5 votes
2 answers
3k views

create empty link

I am using the following code. $url = Url::fromUri('javascript:', array('external' => true)); $link = Link::fromTextAndUrl(t("#action"), $url)->toString(); It causes the following error: ...
4 votes
4 answers
4k views

Get title from Route

I am trying to print out a few links on a custom page template. I would like to use the title and url from each route. I am trying to print out the title from the route. I know I can get the url ...
0 votes
0 answers
80 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
30 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
53 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
2k views

drupal_goto in new tab

Shortly: How can I open a drupal_goto() result in a new tab? More details: I've got a list of news, made with Views, that can be imported from a RSS feed (big custom module, very complicated, etc, ...
36 votes
10 answers
95k views

How do I create a link?

Say I am extending The blockBase class to create a custom block, and I am implementing the blockBuild method to create some markup for my block. Something like this: class YourModuleBlock extends ...
2 votes
1 answer
143 views

Non-Config Menus

I have this requirement where I would need to create a menu every time a user creates a new instance of a custom entity I'm building. One can easily do this with Menu::create() on entity creation, but ...
1 vote
1 answer
571 views

Add a download link to menu

I am trying to add a link to a managed pdf file to the footer menu. Right now I am using a controller which uses a specific route in order to download the file: // src/Controller/DownloadController....
1 vote
1 answer
267 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 ...
1 vote
1 answer
353 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
0 answers
47 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
35 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
379 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 => ...
6 votes
4 answers
6k views

Migrating link fields to Drupal 8

I am trying to migrate a link field field_url from a Drupal 7 site to my Drupal 8 one. The link field is compound, it has a title and a url value. In my process plugin I am selecting the right values (...
0 votes
1 answer
27 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 ...
1 vote
1 answer
3k views

Can menuTree load a menu's items including children

From what I understand I should be able to retrieve all the items in a menu using menuTree. However I only get one level/depth no matter what I try. My Menu Looks Like: Imported Content --Products ---...

1
2
3 4 5
33