Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [routes]

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

23
votes
1answer
24k views

Get the route name of the current page

The route name of the current page is available in page.html.twig? The page is generated by the default feedback form.
0
votes
0answers
10 views

How can I use full URLs for aggregated assets on a specific route?

My organization is using an external search application. The results are intended to be wrapped in a header and footer to mimic the appearance of the main website. I've created a couple of custom ...
0
votes
2answers
448 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
1answer
382 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 ...
0
votes
2answers
370 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
2answers
385 views

How to avoid url conflict when defining menu items, and make sure path without wildcards will be used in favor of path with %?

In hook_menu, I have $path = "events" $items[$path] = array( 'title' => t('Events'), 'page callback' => 'my_events_page', 'access arguments' => array('view my events'), 'type' => ...
0
votes
0answers
19 views

Create Custom Views Link with arg

its about Drupal 8, i created views with link "/admin/x" ... i want create menu in mymodule.links.menu.yml to open "/admin/x/city" i'm using in mymodule.links.menu.yml: imapping....
0
votes
1answer
386 views

How can I reorder active menu items programmatically?

I have an 'audience' menu which has 4 links. When a user visits one of these links, it becomes active, and I want to push it to the front of the menu item list. Outcomes would like like; Pitchers | ...
0
votes
0answers
18 views

Trying to send data from client (JS) to server (D8) using jQuery.ajax [duplicate]

I'm new to D8 but have some D7 experience. I'm trying to receive some JSON data from the client and process it in my module. I have successfully received (I can break on it in my debugger) the ajax ...
0
votes
0answers
12 views

Hide “empty” menu parents

I have the following scenario: I have a sidebar that contains my mainmenu. Menuparents are linked to route:<nolink>. Those parents can be expanded using superfish (accordion). When a user has ...
0
votes
2answers
3k views

How do I call a controller method from a twig template and passing arguments to it?

I know I can pass variables to templates using render arrays. $theme = 'block-AcademicDisplay'; return array( '#theme' => $theme, '#content' => $content, '#url' => urlencode($url), ...
2
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
381 views

Multilingual Views and fixed-language menus

I'm having difficulties setting up a multilingual site. The main difficulty being the menus. Until now, I have had one Main Menu, where I was placing all links. There was a problem though with active ...
1
vote
1answer
396 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
14 views

Pass argument when overriding controller in RouteSubscriber

I am having the issue of overriding the default taxonomy controller /taxonomy/term/{tid}. I have created my own controller which takes {tid} as a parameter and I want to use it instead, so I overrode ...
0
votes
2answers
402 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
2answers
1k views
1
vote
1answer
407 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
2answers
405 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 ...
3
votes
1answer
407 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
409 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
413 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 ...
0
votes
1answer
20 views

Template suggestion don't work with a custom menu link (custom route)

In a module I have created a custom link by creating a custom route inside the mymodule.routing.file.yml and the mymodule.links.menu.yml file. In my theme.theme file I have defined a hook_page_alter ...
0
votes
1answer
429 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 (...
8
votes
2answers
2k views

What is the equivalent of hook_translated_menu_link_alter() to Alter a menu link?

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; if (!...
0
votes
1answer
489 views

Create menu link for authenticated user programatically

So here is what I've tried in custom module dir I've created module.links.menu.yml file here is code. I want to just for authenticated user beside Content link have my custom link to access Webform. ...
3
votes
2answers
100 views

How to hide a menu from <front> page?

The main menu comes with 5 items. How can I hide one items from the < front > page, i.e. 4 items are shown on front page, 5 items are shown on other pages?
0
votes
1answer
442 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
2answers
469 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
461 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
457 views

How to use shortcodes to insert tabs, toggles and other elements in nodes?

I would like to be able to insert certain elements (tabs, accordion toggles, tooltips etc..) and layout/formatting options (columns and layout dividers, boxes, containers etc..) in nodes using ...
1
vote
1answer
44 views

Passing Argument in Drupal 6 not working [closed]

Im very new to drupal. Recently I have started learning drupal 6 with reference project done by my friend. It was having so many bugs and fixed most of from the list. Still Im not getting how hook ...
1
vote
1answer
152 views

hook_menu wildcard auto-loader for webform submission?

In hook_menu() array keys, you can specificy wildcard tokens to autoload certain objects, such as %node to get the node object. Is there a wildcard autoloader token for webform submissions? Some ...
1
vote
2answers
273 views

hook_menu() items created in a custom module don't retain the active-trail of the parent tab

So I have a custom module that is adding 3 menu items (a main tab, and 2 sub-tabs). When navigating to the main tab (url: /casereports) the default_local_task is displayed as expected and both menu ...
2
votes
1answer
463 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
485 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: ...
14
votes
2answers
2k views

If two modules both defined the same menu path in 'hook_menu', which one Drupal will choose?

For example, "moduleone" defines the path 'admin/hello', which output print_moduleone_stuff(). /** * Implements hook_menu() */ function moduleone_menu() { $items['admin/hello'] = array( '...
0
votes
1answer
24 views

Why does the title callback of /user produce the title for /user/register?

I'm a bit puzzled why the title callback of /user produces the title for /user/register and /user/password. When I set the title callback of /user, I see this affects the title of /user/register and /...
0
votes
1answer
46 views

Custom content entity route or url alias

I'm not certain if I'm over-complicating something or just missing something or other. Essentially, and in addition to a separate admin view of my custom entities, I want to assign a URL to them at ...
0
votes
1answer
506 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 ...
0
votes
0answers
49 views

Splitting routing.yml in multiple files [duplicate]

I have a my_module.routing.yml file and because of I have multi entity in my module its too big and not pretty. Is there any way to split it for each entity and include them in one file like symfony, ...
5
votes
1answer
509 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' ...
1
vote
1answer
472 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
1answer
495 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 ...
0
votes
2answers
516 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
1answer
508 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
2answers
499 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?
2
votes
1answer
488 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 ...
8
votes
2answers
6k views

How to test if current page is an admin page?

At some point I started using the following code to test if current page is an admin page: $route = \Drupal::routeMatch()->getRouteObject(); $is_admin = \Drupal::service('router.admin_context'...
0
votes
1answer
66 views

Return data from WebformHandler to Controller

I created WebformHandler where I need to get data entered in the form on submit. It's something like this: <?php namespace Drupal\xxx\Plugin\WebformHandler; use Drupal\Core\Form\...