Questions tagged [routes]

Using a term introduced in Drupal 8, routes are the paths to which modules respond.

Filter by
Sorted by
Tagged with
0
votes
1answer
419 views

Creating some views fields for a taxonomy menu with the active trail CSS classes?

I have a taxonomy vocabulary which I want to use to create some navigation on my site. Terms: Weather Clothes Calendar Sports I want to be able to pull these terms and put them in the navigation ...
0
votes
2answers
461 views

Tab Tamer - Hiding tabs based on Roles

Tab Tamer Module only does but so much. I want to hide a tab for anonymous users and have it active for other admin users. This just turns it off completely. Any ideas?
1
vote
2answers
3k views

Disable caching on a route

I have a route with a parameter, e.g. /r/{app_id}. The controller extends ContainerInjectionInterface. The method either returns a render array or a new TrustedRedirectResponse. I believe I have a ...
0
votes
2answers
409 views

Altering the type of a menu item to local task (tab)

I've searched for hours but I can't find a good answer on how to alter the type of a menu item to local task (tab). The private messages 7.x module (when aided by privatemsg_filter) exposes the ...
1
vote
1answer
452 views

How to change autocomplete_route_parameters value on change of select option?

How to change autocomplete_route_parameters value on change of select option? I have a form element and inside autocomplete_route_parameters, I want to change $langcode value when I select any ...
12
votes
3answers
6k views

Redirect Anonymous user to login page

I want if user not logged in and visit any page of my website except my REST VIEWS routers I redirect him/her to login page in drupal 8, I found this solutions for drupal 7 but didn't find any ...
5
votes
6answers
13k views

How to add / remove tabs from user profile?

By clicking on the "My account" link that on the secondary menu on the site, the user is redirecting to the user's profile page. In this page there are many tabs. Some tabs are there originally, and ...
0
votes
1answer
39 views

Scoping an admin link to only show for certain node bundles

I have 2 node content types / bundles, A and B. each A has a relationship with multiple Bs. When on the edit page, node/%/edit, for A, I want to show a link to the list of related B so that an editor ...
0
votes
2answers
403 views

Titles not showing for tabs pages

Below is the array in my hook_menu The only issue that I have with it is that the titles are not displaying for tabs pages (the last three array collections). They are showing the title for the ...
0
votes
1answer
416 views

Entity reference of a menu link gives Restricted access instead of the real data

I am trying to create an entity reference of a "menu link", but instead of having the menu link name I got "- Restricted access -". It seems to be the same problem with wysiwyg profile. I'm using the ...
-1
votes
0answers
38 views

Generate a slug for a custom route

I have created a custom route and i'm trying to figure out how to replace the node id by a slug. I have this: /my-custom-path/1 I want this: /my-custom-path/a-node-slug How can i do that ? Thanks ...
0
votes
1answer
70 views

Why is $form array empty when extending FormBase or NodeForm

Why is $form not upcast with the requested bundle's fields for the default Form Mode for GET requests; and with the entities' values for other method requests? My form: namespace Drupal\tam_api\Form;...
1
vote
1answer
30 views

Get unsaved node from route parameter

What I want: In hook_media_presave I want to set a field value according to the same field on the referring node. By the referring node, I mean the node where the media entity is created through an ...
2
votes
3answers
664 views

taxonomy menu select list with redirect when a menu item is selected

I'd like to have a taxonomy drop-down list like the one in www.1mobile.com. When I select an term, it should go to the respective page, showing products concerning with selected term. I tried Custom ...
2
votes
2answers
916 views

Can we have multliple routing.yml files in a single module?

I have more than 50 menus which I need to create custom. as per the module structure, we need to create routing.yml in root folder. but I want to do something like this below: myModule - ...
1
vote
1answer
73 views

How can I change Menus depending upon domains (url name)?

I want to change main menu items depending upon domain and sub domains url in a single site. I could have done it easily with roles, but issue w.r.t anonymous users. How would I show or not certain ...
3
votes
3answers
2k views

Adding menu with description like mega menu [closed]

I would like to create a menu with a description of the menu like megamenu. My menu looks like the following model: How can I create this?
1
vote
1answer
422 views

Drop Down Menu in Alphabetic Order

I have a Drupal Website and a few Drop Down Menus in there which comprise of a list of products. However , the list of products does not appear in alphabetic order. I tired "reset to alphabetical" for ...
1
vote
1answer
396 views

OG menu default links are not adding up

I am using og_menu 7.x-3.x-dev I am trying to create some default links to the og menu, but links are not adding.With a new group node its creating the og menu but the default links are not coming.Do ...
-1
votes
2answers
647 views

Retrieve argument in hook_menu() item url

On my custom module, I defined the following hook_menu() function. function motel_events_menu() { $items['ajax/pastevents/%'] = array( 'title' => 'Get Past Events', 'page ...
1
vote
1answer
39 views

Set default menu link as default menu?

I have sub menu of Main menu. I need to set 2nd sub menu as default menu, so when user visit a site 2nd sub menu should open.
3
votes
2answers
1k views

hook_menu() wildcard problem

I can't get the wildcard from a hook_menu to pass it to a callback function Here is what I have: function spin_menu() { $items = array(); $items['spin/login/%'] = array( 'title' =&...
1
vote
1answer
44 views

Customizing menu link output (add badge)

I am new to drupal. I want to customize menu link <ul class="nav nav-tabs sub-menu"><li class="menu-1308 first active"><a href="/" class="active">Top</a></li> <li ...
0
votes
1answer
64 views

How to alter main_menu for logged user?

I would like to alter/change structure of main menu links (programmatically!) for logged in users. What is the simplest way to do this?
1
vote
1answer
399 views

How to add subtitle for menu items in Nice menu in Drupal 7

I'm using nice menu in my durpal-7 site.I need to show a subtitle for each menu item.How can this be done ? I'm new to drupal so it would be great if you could help me.
3
votes
1answer
413 views

Limit menu items available as possible parents on node creation

As I create a node I want to assign i to a menu item parent. I know that I can limit it to what menu(s) are available on: /admin/structure/types/manage/my_type But it would narrow it down to "only ...
2
votes
1answer
661 views

Add Meta tags and Title on hook_menu “page callback” [closed]

How to add Meta and Title tags to the document head on hook_menu "page callback"? Drupal 7
1
vote
0answers
56 views

Using active trail as url path

I would like to use the active trail menu as url path by altering pathauto? Can this be performed?
1
vote
1answer
2k views

Is there a way to show all routes used?

I want to get a list (dump) of routes used? Example: /user/register /user/logout /custom/route /node/27/some-description
7
votes
5answers
14k views

How to correct disappearing admin menu?

I use the Admin Menu module for my projects. In my Drupal 7 and Pressflow 7 instances, it randomly shows only some menu items. At first, I thought I could correct this by clearing menu cache. When I ...
0
votes
1answer
59 views

how to extend FormBuilder::processForm from multiple API endpoints in one class

I'm trying to consolidate my form processing by entity_type, without rebuilding the forms (just using the default forms provided by Drupal. I have dynamic routes pointing to a _controller::method. I'...
3
votes
3answers
3k views

How do I use variables in links.task.yml?

I have a local links.task.yml file to display the tab for the node data , But it seems to have a problem passing argument to the path . As you can see i am extending the node's basic fetaures like ...
2
votes
1answer
420 views

Hiding Menu Links Based on URL

Is there a way to hide menu links on the main menu based on the URL? For instance, if my URL is 'example.com/undergraduate', the main menu links would be different than if I were to go to 'example....
0
votes
1answer
443 views

Secondary Tabs and views

I am trying to get Secondary Tabs to work. I want to create a local tab with sub tabs. View | Edit | Reg Report Reg Report     Reg Report | Pre-Registration | Post-Registartion (...
0
votes
0answers
24 views

How do I redirect to an external URL in new tab by using RedirectResponse or TrustedRedirectResponse?

I need to use TrustedRedirectResponse on my site and open the external url in new tab?How can it possible in drupal 8
3
votes
2answers
2k views

Alter existing route to a different route for a specific content type node using RouteSubscriber

I want to modify node edit of a specific content type node to a different route . Eg : suppose i have a node edit page route as entity.node.edit_form (core feature) . And now i want to change this ...
1
vote
4answers
587 views

How to show sub-menu in a block in drupal 7?

I have a menu in Drupal 7 with 2 main links like home and about us, but I have 3 sub menu in about us like About us About Us 1 About Us 2 I need to show these 2 submenu in a block and show ...
1
vote
2answers
25 views

Entity access controler not called from custom route

I define a custom entity named "Politician", where I set the class PoliticianAccessControl as an access handler. This is working fine for the canonical url of the entity set in the following way: ...
0
votes
0answers
46 views

Why Form Api behaves differently in route and in custom block?

I’ve encountered this issue several time and I don’t know why. I know this not so easy to reproduce but maybe someone has an explanation. I’ve built several custom modules which return datas from ...
11
votes
4answers
7k views

Increase memory limit doesn't help in Fatal error: Allowed memory size of …/modules/views/views.module on line 416

I've switched from Drupal 7.14 to 7.15 three weeks ago and therefore, I'm encountering a series of very sophisticated (for me) memory limit errors. Those errors occur any time I'm trying to clear ...
2
votes
1answer
474 views

Want parent MENU_LOCAL_TASK tab to show when on a child page

I have a set of local task menu items defined in my module. This includes the following items: control => MENU_NORMAL_ITEM control/jobs => MENU_DEFAULT_LOCAL_TASK control/jobs/% => MENU_??? control/...
1
vote
0answers
29 views

what happen if i have the same route as path alias?

What if I have the following route in a custom module and a path alias that is equal to the route path? mymodule.contact: path: /contact defaults: _controller: Drupal\mymodule\Controller\...
1
vote
2answers
506 views

Print Main Menu inside a block

Very new to Drupal--trying to understand building a dynamic navigation menu for end users to handle. Is it possible to print the Main Menu inside a block I'm using for the header? e.g. <nav id="...
0
votes
1answer
485 views

is it possible to have multiple access callback for a menu item

I am trying to add access callback to already existing access callback for a menu item. For eg, path = [node/nid/edit] with access callback 'AC1'. Now is it possible for us to add another access ...
0
votes
1answer
606 views

How to have OutboundPathProcessorInterface change the URL of the loading page

I have a page my/topics. The page presents content based on the user's selection from another page. Having made the selection, it and other information is passed to the page via a query string: ...
0
votes
1answer
444 views

Displaying parts of main menu in separate blocks

I need to display my main menu in separate blocks: the first sub-menu in one block, and the following two sub-menus in another block. I'm using Drupal's native menu module and also the nice menus ...
1
vote
1answer
557 views

RouteNotFoundException when trying to delete a custom entity

I am building a custom component in Drupal 8 that has an entity with child entities i.e., TeamEntity has one or more MeetEntity objects. When I navigate to the "Delete" link for a given MeetEntity, I ...
0
votes
1answer
35 views

Why isn't my controller returning AccessResult::forbidden()?

I'm working on a node access module. I've set up my logic. I can't seem to get my code to return AccessResult::forbidden(). I can't even get \dpm to run in access method. What am I doing wrong? Below ...
3
votes
2answers
3k views

How do I implement the equivalent of hook_url_inbound_alter()?

I'm working on a module which will resolve URLs to entities by altering inbound URLs so that if they contain an entity ID with following pattern "-{entity_id}" user will be redirected to correct URL. ...
2
votes
2answers
1k views

How do I build Breadcrumbs for a certain node?

In a node preprocess hook I am getting breadcrumbs for the currently viewed node by doing the following: $vars['breadcrumb'] = Drupal::service('breadcrumb') ->build(Drupal::routeMatch())->...