We’re rewarding the question askers & reputations are being recalculated! Read more.

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
2answers
416 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 ...
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 ...
5
votes
1answer
52 views

Is there a way to partially rebuild the router or invalidate a route cache?

I'm using the Groups module (http://dgo.to/group) to set up groups on a SaaS project I'm working on. I've set up a domain field on the groups, allowing groups to have vanity domain. As such, groups ...
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 ...
2
votes
1answer
173 views

Adding multiple menus entries to a view

We have a view with a page attached to it. By default the settings screen pictured below lets you add only a single menu entry for the view. Is it possible to have this featured in two or more menus ...
3
votes
1answer
414 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 ...
1
vote
1answer
57 views

How to store temporary metadata for the remainder of a request?

I am looking for a way to store some additional metadata for the remainder of a request, that should be removed after the request has finished. Sessions or SharedTempStore store persistent data across ...
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.
0
votes
1answer
419 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 ...
2
votes
2answers
4k views

menu access callback per role

I'm trying to implement an access callback per role for a specific menu item, but other roles can view that menu item also. Any tip is welcome. /** * Implements hook_menu(); */ function ...
2
votes
0answers
40 views

How to get module name from a given route object?

In a runtime context, given I have a route object, e.g. from route name user.register, how do I find the path or routing.yml or other definer of the route? Does Drupal or Symfony provide for this? ...
1
vote
1answer
433 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 ...
0
votes
3answers
354 views

specify context on hook_menu drupal

I would like to check if particular node instance exists then load that node. if the instance does not exist, then display message. So far: function MODULE_menu() { $items['ds-some'] = array( ...
2
votes
1answer
424 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....
3
votes
5answers
3k views

How do I filter a menu to only show menu items translated into current language?

In my Drupal 8 project I have a menu containing menu items in english. Some of the items have a german translation. How do I filter the menu to only show the german items when viewing the site in ...
0
votes
1answer
464 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 (...
2
votes
1answer
482 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/...
0
votes
1answer
342 views

Return Table and Form in page callback

I have a problem returning table and form in page callback at the same time it only works if one of them only returned. function _table_maps(){ $query = db_select('maps','m'); $result = $query->...
1
vote
2answers
530 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
3answers
40 views

Can I create a form with a route like this /rooms/{node.alias}/booking?

I'm working on a booking project and I have to create a form for reservations. I have created the accommodation content type and the url_alias for this is: /rooms/[node:title] Example: /node/1 = /...
1
vote
0answers
31 views

Custom module route to config form deleted, now the site is down

So I have a custom module Domaincheck which had an admin configuration form. Since that one is not needed at all, I decided to clean up and delete the form and route. That resulted in a Symfony\...
3
votes
2answers
2k views

How can I create menu links to external URLs?

With my module MYMODULE I would like to create external link and place it into main menu. Is it possible to do that in MYMODULE.links.menu.yml file or MYMODULE.routing.yml? Something like this??? ...
3
votes
1answer
22 views

404 Not Shown For Custom Module - Drupal 7

In a hook_menu() implementation, I am defining a route for login. function my_account_menu() { $items['login'] = array( 'title' => 'Customer Login', 'page callback' => '...
5
votes
7answers
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
495 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 ...
1
vote
1answer
586 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
449 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 ...
0
votes
1answer
719 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
540 views

Adding class to nested UL in Drupal 7 menu

I'm creating my menu using view along with Bootstrap to create a mega menu style navigation. I'm having a problem with the nav showing expanded at times when you come to the site and or refresh. not ...
2
votes
2answers
708 views

Overriding an entity add/edit form through alterroute

I want to create my own version of the add/edit form for an entity defined in contrib module (drupal_commerce). I assumed i'd be able to adapt the example here http://www.foreach.be/blog/how-...
2
votes
0answers
66 views

How is a response generated?

A generic basic PHP Application using Symfony uses code similar to the following one. $request = Request::createFromGlobals(); $context = new RequestContext(); $context->fromRequest($request); $...
4
votes
1answer
571 views

Providing menu route parameter values from url

Suppose I have the following route in my ej.routing.yml file: ej.form.user.profile: path: '/user/{user}/ej_profile' defaults: _title: 'EJ Profile' _form: '\Drupal\ej\Form\User\ProfileForm' ...
0
votes
1answer
23 views

Forward authenticated user to user.page on /login uri

If an authenticated user navigates to /login on a Drupal 8 site, she gets the "access denied" error. I want the site to redirect that user to /user (route user.page) instead. Unfortunately my ...
0
votes
1answer
238 views

Dynamic local tasks to the same route with slug

I have a route set up with a slug accepting taxonomy terms (routing.yml): example.column: path: '/column/{taxonomy_term}' I would like to add (secondary, although that's not important) local task ...
1
vote
1answer
483 views

Override theme function for menu callback

What I am looking for: I have a custom node link which, when clicked, displays a custom HTML content (option selections) in a lightbox. I need to pass an argument to the HTML content to generate the ...
0
votes
0answers
24 views

Pass rendered markup to redirect route

Drupal 8.7.x I have form that passes the outputted data into a template. This template with the data gets rendered into a string like so: : public function submitForm(array &$form, ...
2
votes
2answers
44 views

How can I add an age validator page?

To access the site, all users (except the logged-in users) need to pass through an age gate. They can only leave the welcome page if they are 18 years or older. I started by adding a session to my ...
1
vote
1answer
44 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\...
2
votes
1answer
492 views

Problems with active-trail within a Views-generated block

I have played with Menu Trail by Path and Menu Position, but none worked well with a Views-generated listing acting as a navigation menu. Imagine the following scenario: On the left side there is ...
3
votes
1answer
177 views

Why does this route work with a slash and not a dash?

I have defined a custom dynamic route that works, but isn't ideal: /** * Defines dynamic routes. */ class GuideUnitRoutes { /** * {@inheritdoc} */ public function routes() { $...
1
vote
1answer
580 views

Config Entity list_builder controller path throws Route Does Not Exist error

I have created a custom config entity, which declares a list_builder controller to return a list of the created entities. Before creating a config entity, it renders as expected. Once I create a ...
5
votes
2answers
435 views

Do new routes require a static first portion?

Using mymodule.routing.yml, I can successfully create a custom route at /foo/{bar}/{baz}, but I cannot use /{bar}/{baz} or /{bar}/foo/{baz} as path for a route; they just return a 404 error. Why? Is ...
0
votes
2answers
564 views

How to create parent child menu programatically?

I have an array like this : Array( [0] => Array( [link_title] => Level == bod [link_path] => link1 [menu_name] => parrent-child-menu [weight] => 1 [expanded] => 1 ) ) Array( ...
1
vote
2answers
510 views

Render page callback output in another region than “content”

I am implementing hook_menu and I want to render the output of one page callback in a certain region, other than content. Is there a way of doing this?
0
votes
1answer
511 views

Permission for translating menu items via the menu config screen

I have a multi language Drupal site, Using i18n and the entity translation approach. Translating menu items from an node works well, but not all the menu items are driven by the nodes. Now as user/1, ...
1
vote
1answer
30 views

How does routing order / matches effect performance?

I have all the following GET routes defined in my_module.routing.yml: my_module.members_uid: path: 'users/{user}' my_module.members_uid_gid: path: 'users/{user}/group/{group}' my_module.user....
0
votes
1answer
29 views

Is it possible to invoke cron within a hook or route class?

I'm using the Deploy suite, which requires cron to be run after a deployment is created. However, when I try to execute \Drupal\Core\Cron::run(); from hook_entity_create() or from a route Class, it ...
3
votes
2answers
584 views

hook_menu create a URL/Menu Item

I'm trying to create a page through hook_menu so I can add my custom block with context instead. function my_module_menu() { $items['my_page'] = array( 'title' => 'my_page', '...
5
votes
2answers
3k views

how to create a route with query string?

I have tried a few things and I cannot manage to make this working. My route is the following. amu_hal.publicationsPerYear: path: '/publications/{year}' defaults: _controller: '\Drupal\...
0
votes
1answer
29 views

When does hook_menu run?

I need to edit the hook_menu function in my module. I need to add a new link to a menu, and edit the path for an existing link. Is this possible without creating a whole new module? The only ...