Questions tagged [navigation]
Use it for questions about navigation menus and links used in a site.
1,608
questions
1
vote
1
answer
2k
views
Changing the url which the logo links to
I'm using Zen Theme 5.x and want that the site logo links non to the front page but another page in my base url, like to a contact page. It seems that I can achieve this modifying the page template ...
0
votes
1
answer
154
views
Main menu is hidden from unauthenticated users
I am using a slightly modified Responsive Batrik theme. The odd thing is that the main manue and site logo are hidden from unauthenticated users. When they log in, they can see the menu and logo.
I'...
1
vote
2
answers
241
views
Show custom menus in seven theme
I am using Seven for the theme of a internal application. I have custom items setup in the mainmenu, but cannot get it to show?!?!
The blocks for seven are limited to content and help (despite the ....
1
vote
1
answer
566
views
Adding website logo as the first top level menu item in tb megamenu [closed]
I am usting tb megamenu module to get a main menu on my site.
Is there a way to add the website's logo as a top level menu item (NOT SUBMENU ITEM)
2
votes
1
answer
56
views
Display external link using theme settings
I'm using theme-settings.php to store links to external pages (like Facebook, Twitter, etc.) and the links aren't storing correctly. In theme-settings.php, I have:
function ...
2
votes
2
answers
283
views
Views Accordion to be accessible by keyboard
I need the Views Accordion module in Drupal 7 and what is in it to be accessible by the keyboard. When you are tabbing, it skips it completely. Also the screen reader does not recognize the closed ...
2
votes
1
answer
116
views
When I clear cache, my menu ordering seems to go out of order
When I clear cache, especially on high traffic times, my menu seems to go out of ordering. Usually I don't see any log messages except for one time:
Message Drupal\Core\Database\...
0
votes
1
answer
2k
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
1
answer
212
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 ...
1
vote
3
answers
94
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, ...
0
votes
1
answer
114
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 ...
2
votes
2
answers
520
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
2
answers
4k
views
How do I add local tasks menu to a views page display
I have created a views page display that has the path /node/%node/sessions, contextually filtering by content ID. It also creates a "menu tab" called "Sessions".
Therefore when I got to node/12 I ...
1
vote
1
answer
21
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 ...
1
vote
2
answers
967
views
User specific permission to add links to a menu
When I create a content type, e.g. 'Basic Page' and I want to add a link to a menu I do usually the following:
Menu settings -> Provide a menu link -> choose a menu and its position of the link there
...
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 ...
0
votes
3
answers
5k
views
Sub-menu items in twig
How can I theme all the menu levels individually in menu.html.twig?
I need to give different markup to the 2nd (child) and 3rd (grandchild) level, and in the twig I only have parent and child.
{% ...
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 ...
0
votes
1
answer
519
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: '...
1
vote
0
answers
72
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 ...
0
votes
0
answers
81
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 ...
0
votes
1
answer
266
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:
...
0
votes
1
answer
530
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 ...
0
votes
0
answers
175
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 ...
0
votes
0
answers
37
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 ...
0
votes
0
answers
36
views
Why do I see the node ID on the menu URL instead of the path alias?
I created different menus and need them to be displayed in a node based on the language currently visited for a specific node type.
Via my theme.theme, I added the following code to retrieve the menus:...
1
vote
0
answers
25
views
Local action on node but path a child of node?
I have created two local actions which I want to display on my nodes, General Configuration and Advanced Configuration.
General Configuration will show at node/%node, but Advanced Configuration is ...
6
votes
3
answers
7k
views
Adding a link to an image
Is there a module or a way in core to have an Image field be a clickable link to a URL that is either entered as an additional setting for the Image field or can be pulled from another field that ...
0
votes
0
answers
125
views
Menu token not working sometimes
I am using /user/[current-user:uid]/edit to generate the user profile setting page where user can edit there profile.
Sometimes it works and sometimes it displays the wrong user id and sometimes I get ...
1
vote
3
answers
4k
views
Load a full menu with active trail
I need to load a full menu for navigation in a custom theme with active trail, and can't find any way to do it, but that can't be right. I can't imagine such an obvious and widespread use-case having ...
0
votes
2
answers
83
views
Menu hook callbacks not working for anonymous users
My custom error handler module is somewhat based on the customerror module, but instead of returning markup, my menu callback function redirects based on the original path. It registers error paths as ...
3
votes
1
answer
707
views
Navigate to next page / previous page based on entity reference field instead of Book module
I am trying to create next/previous page links like the Book module.
I have two content types, Chapter and Page.
The Chapter content type contains an entity reference field (unlimited) for pages.
...
2
votes
2
answers
6k
views
How to load a menu item and its children menu items? [duplicate]
I have the menu item id. I want to display that menu item with its children.
Suppose for example I have menu item test and it has two children menu items. So I want to load them and display it as
...
0
votes
1
answer
204
views
Unable to Edit Main Navigation Drupal 8
I installed a custom theme called StartupGrowth. At the moment, I am trying to edit the main navigation. When I go to Structure->Menus->Main Navigation and disable the unneeded entries, they do not ...
5
votes
4
answers
3k
views
Font Awesome icons in link field
I would like to have a font awesome icon in my link text.
<i class="fa fa-pencil"></i>Blogs
Since link fields are generated in LinkGenerator.php, they get escaped.
if (!SafeMarkup::...
0
votes
1
answer
304
views
How to get links of translated node edit page in the secondary tabs
In D7, if a node is translated, let say in French and if you are in the entity.node.edit_form page then you could find 2 secondary tabs: [French] and [English] pointing to the edit_form of each ...
2
votes
2
answers
453
views
How to check "Show as expanded" by default on the Add menu item page
I need the 'Show as Expanded' checkbox on the Add menu item page to be selected by default.
I created a module, 'expand_menu_items', and tried a hook_form_alter function to get the id, apparently it'...
1
vote
2
answers
1k
views
How do I retrieve a menu using its link?
Let say I have a menu item with these attributes
'title' => 'Menu Title',
'link' => ['uri' => 'internal:/taxonomy/term/1217'],
'menu_name' => 'my-menu',
'expanded' => TRUE,
I can find ...
0
votes
1
answer
331
views
How can I programmatically delete a custom menu?
I'm writing a hook_deploy_N that moves a bunch of menu items from a deprecated custom menu to some newer ones. So far, so good. After moving the items, I want to delete the old menu, but can't figure ...
5
votes
3
answers
6k
views
Alter the access of menu links before rendering
I need to alter the access of menu links before being rendered. In Drupal 7, we used hook_translated_menu_link_alter() for it. Drupal 8 change records show that there are no direct replacement for ...
9
votes
2
answers
7k
views
What is the equivalent of hook_translated_menu_link_alter() to alter a menu link? [duplicate]
I want to alter the menu link in Drupal 8. In Drupal 7 we can achieve this using hook_translated_menu_link_alter().
function module_translated_menu_link_alter(&$item, $map) {
global $user;
...
1
vote
1
answer
842
views
How to translate menu items with migrate?
I'm importing menu items from CSV using migrate, migrate_tools, migrate_plus and migrate_source_csv.
This is an example of how I'm doing it for the original language:
source:
plugin: csv
path: '...
0
votes
0
answers
24
views
Menu links won't appear
I generated 2 entities and addtyed a new Form with the overview of them. But when I try to add links, they won't appear. I follow the guide but wont work. Form and Entities work. The routings are ...
0
votes
0
answers
121
views
getUrlObject() returning empty proto object
I'm trying to follow this post to turn my menu tree into an array I can more easily work with.
When I run my code and look at $filteredArray I get:
title: *Name here*
url_obj: {}
has_children: true
...
2
votes
1
answer
345
views
Links in view - wrong language selection
Ok, I'm not sure where should I go with this problem, so forgive me if this is not the exactly best place for it.
I've created multilanguage site, of course, got many problems, but solved them all - ...
0
votes
1
answer
94
views
Drupal 8 Accessing Menu Tree in a Block's JS
How can I pass the menu into a block's javascript?
I am trying to build a block for a custom mobile menu (client wants specific logic/animations/etc) and use that in Structure > Block layout > Main ...
4
votes
2
answers
4k
views
Set parent for programmatically created menu links
I'm currently programmatically generating a menu and menu links inside it. This is working but I'm having trouble setting the parents for the links. Here is my current code
$langcode = 'es';
...
5
votes
4
answers
3k
views
Customize the HTML of a link field from a custom theme
I've a Link field named field_home_link, attached to a Content Type named Home, and I'm trying to customize how it is rendered as HTML from inside a custom theme.
Instead of the default generated ...
2
votes
1
answer
1k
views
How to add local task links to referenced entities for a specific content type?
I have a content type with some entity reference fields to another content types. I want to add local task tabs to the node view page, to link those referenced node. However I cannot figure it out how ...
0
votes
2
answers
410
views
Breadcrumbs/menu for dynamic pages
Im breaking my head around getting the breadcrumbs set properly on views page.
my views' page address is "teachers/%" where % is a term-id.
I have a content type called 'program' with a field ...