Questions tagged [routes]

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

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

How can I rebuild the cache for a specific route when a node of type foo is updated?

I created a page by a module and the cache of that page must be deleted if a node of node-type 'foo' is updated. How do I do that? I read https://www.drupal.org/docs/drupal-apis/cache-api/cache-tags ...
tis's user avatar
  • 75
0 votes
1 answer
40 views

In Multisite setup the custom page '/speakers' should available on domain1 site only

I have Multi-site setup , want to make available custom page say '/speakers' on domain1 site but not on domain2 site I have tried to figured out in routing.yml file to check is there way to pass any ...
mini's user avatar
  • 692
-1 votes
1 answer
57 views

Custom module routing is going to page not found

I have a custom module that i'd like to display my webform on a certain page but it keeps sending me to a 'Page not found'. folder structure is; modules/custom/custom_webform_display -...
bennyc's user avatar
  • 19
0 votes
0 answers
90 views

How can I make route optional parameter "dynamic"?

I have a route which need to have the language code as optional parameter: my_module.my_route: path: '/custom-link/{langcode}' defaults: _controller: '\Drupal\my_module\Controller\MyController:...
Giuseppe's user avatar
  • 907
0 votes
2 answers
61 views

Set cacheability on a custom route returning XML

I'm working on fixing a custom module that returns XML from a certain route. Essentially what is described in the answers of this question. Currently this route isn't being cached. I've tried to ...
Vecta's user avatar
  • 603
0 votes
0 answers
18 views

Avoid TypeError when route with type hinted parameter in controller is called with wrong parameter type

We defined a route under which a visitor of the website can find some information about how to get data related to the currently shown entity: aw_api.open_data.info: path: '/open-data/info/{...
Tobias Krause's user avatar
0 votes
2 answers
54 views

block_content routes have ambiguous paths

I'm trying to convert block forms (the content entity forms) into Gin Admin theme forms. Gin theme provides a hook for this: function hook_gin_content_form_routes(): array { return [ 'entity....
Hudri's user avatar
  • 5,311
1 vote
2 answers
43 views

How to pass node argument to a local task form?

Suppose I have a route for a local task like this: MODULE_NAME.node_options: path: '/node/{node}/options' defaults: _form: '\Drupal\MODULE_NAME\Form\NodeOptionsForm' _title: 'Options' ...
Anders's user avatar
  • 145
1 vote
1 answer
49 views

Local task for content node doesn't show up and raises 'Access denied'

After spending two days trying to figure this out, it's probably better to ask for help. I need to add a custom tab next to View Edit Delete Revisions Translate for content nodes (a local task, if I ...
Anders's user avatar
  • 145
0 votes
1 answer
709 views

How to get the parameters from a URL and a route that is not the current one?

Route from a custom module : custom.route: path: /the/{id}/path Hypothetical url : /the/53/path The goal is the get the id value ("53"). So far, I managed to get the route name from the ...
JFC's user avatar
  • 521
0 votes
1 answer
49 views

Dynamically generate Form API select list of routes to page displays of a known View

Given a known View, how would one dynamically generate a Form API select list of the routes to its Page Displays? In my case, I have a Search API View (view.search) with a default site-wide search ...
hotwebmatter's user avatar
  • 2,102
0 votes
3 answers
148 views

Where can i find the path/URL of a module after installing it?

I just installed two modules on a Drupal 9 site: https://www.drupal.org/project/simple_forum and https://www.drupal.org/project/answers. I want to get the URL where all posts/questions are listed and ...
Ivan Leon Yam's user avatar
2 votes
1 answer
256 views

checking route access for authenticated role

I'm outputting a link, made using Url::fromRoute(). If the current user is anonymous, and the route is not accessible to them, I'd like to show a 'Log in to use this link' text instead, simular to ...
joachim's user avatar
  • 846
0 votes
1 answer
326 views

How to get route inside RequestEvent

I need to redirect all existing links targeting a few hand-picked nodes to an external domain. I created an EventSubscriber listening to RequestEvents my.services.yml services: my.request_subscriber:...
Hudri's user avatar
  • 5,311
0 votes
1 answer
264 views

Alter a route according the current user

I'm on D 9.4.x, trying to redirect the node.add route to a custom one, only when the current user has the right role\permission. So I don't think I can't work in the alterRoutes but I probably need to ...
Giuseppe's user avatar
  • 907
0 votes
1 answer
108 views

Creating dynamic controllers for the same route

I have a route defined as my_node_action.go: path: '/node/{node}/go' defaults: _title_callback: '\Drupal\my_node_action\Form\Go::title' _form: '\Drupal\my_node_action\Form\Go' options: ...
Iza's user avatar
  • 13
1 vote
0 answers
1k views

Argument 2 passed to Symfony\Component\Routing\RouteCollection::add() must be an instance of Symfony\Component\Routing\Route, boolean given

Ubuntu 18.04.6 Apache2, Postgresql 10, Drupal 8.9.6, PHP 7.2.34 (most of the modules require these versions) I've tried trouble shooting this problem for multiple weeks. I'm attempting to migrate a ...
Nategamer's user avatar
0 votes
1 answer
49 views

How to forbid acess to a page?

I want to show a "Access denied" (403) page with message "You are not authorized to access this page." for a given route. This will apply to all users in any case. How to do it in ...
dxvargas's user avatar
  • 940
3 votes
1 answer
483 views

All routes resolve to entity.user.edit_form for authenticated users

This is a new one for me: All routes, for an authenticated user, resolve to entity.user.edit_form. Anonymous users are able to browse all public-facing pages of the site without any problems. This is ...
hotwebmatter's user avatar
  • 2,102
1 vote
0 answers
49 views

Count how often a route is called

I have written a custom module that exports nodes in different formats. The module itself works great but now I would to count how often one of the custom routes is called. The desired route in the ...
stopopol's user avatar
  • 141
1 vote
2 answers
238 views

Change the "add entity" page title on a custom content entity type using alterRoutes()?

I created a custom content entity type dog using drush generate entity:content. When I go to www.example.com/dog/add, the page title (the one in the <title> tag, not the <h1> tag) is "...
Patrick Kenny's user avatar
2 votes
1 answer
539 views

How can I make route parameters optional in a routing callback?

I needed to create a route in which the path of the route would be completely dynamic and so I created a routing callback. <?php namespace Drupal\uber_affiliate\Routing; use Symfony\Component\...
Binny's user avatar
  • 886
0 votes
0 answers
16 views

Best way to get a full absolute url from a registered route? [duplicate]

I'm working with a module supplied route, and need to hand it off to an api. That means I need the domain and schema included. I am not finding the right options in the URL class, so I have it ...
DeveloperWeeks's user avatar
1 vote
1 answer
233 views

How do I configure the route to the add form for a content type created as a bundle class?

I've got a custom content entity type, created for me by drush generate and I'm extending that using bundle classes. I've got a MyContentType class and a MyBundle class that extends it and provides ...
Sunset Bill's user avatar
0 votes
1 answer
114 views

Redirection from user login to another page for logged in users

Due to requirements with our reverse proxies, I had to show the user login form on a different URL. Well, no problem, I thought, I'll just copy the relevant section from user.routing.yml and display ...
Francesco Marchetti-Stasi's user avatar
0 votes
1 answer
134 views

Not receiving dropdown of custom autocomplete textfield

I am currently trying to create a postcode lookup which returns a street name in an autocomplete dropdown. To do this I have created a new module containing the following files: src/Controller/...
JCMSmith's user avatar
0 votes
1 answer
50 views

Menu item still visible even though alterRoutes denies access to it

I have the following RouteSubscriber in a custom module: namespace Drupal\frilaering_access\Routing; use Drupal\Core\Routing\RouteSubscriberBase; use Symfony\Component\Routing\RouteCollection; class ...
Morten's user avatar
  • 101
0 votes
2 answers
91 views

Authentication from a dynamically generated form

I have implemented a feature for PDF conversion using an external java program based on iText (performance is not an issue, the system is for internal usage only, users are less than a hundred, ...
Francesco Marchetti-Stasi's user avatar
0 votes
0 answers
384 views

Why is my custom route not working?

I'm writing a module that integrates the Zoom API and subscribes to calls, but I'm stuck on just testing my controller code, as Drupal doesn't recognize the route used by the module. zoom_call_module....
Riley Lutz's user avatar
1 vote
1 answer
360 views

Correctly cache route by dynamic parameter

I have a route with an optional parameter like: /foo/bar/{baz} {baz} is optional. When accessing that route by a value for baz, the page contents are correct, but the breadcrumb is incorrect and ...
Kevin's user avatar
  • 27.7k
0 votes
1 answer
446 views

Send array from twig to controller via route

I have in my twig a link as shown below and I would like to send a lot of data (array) to a controller. How do I go about it ? Do I use params? what is the best way to handle this in your opinion? ...
el sparrow's user avatar
0 votes
0 answers
137 views

Password reset links sometimes don't work

I've got this problem where once in a while, when a user uses the one time password link, instead of going to the password reset page, it takes them to the home page. Whenever this happens, in the ...
zip_000's user avatar
  • 11
1 vote
1 answer
63 views

How do I upcast route parameters for entity_revision?

My custom entity is revisionable. I can see revisions, but my revision revert form doesn't work. The route for the form is definited in msul_rovi_games.routing.yml. entity.rovi_game....
Kevin Finkenbinder's user avatar
1 vote
1 answer
446 views

How to add a top-level link to the Admin menu via the links.menu and routing yaml's

Let's say I want to add an additional link to the admin toolbar after Reports such as Groups does. In my_module.routing.yml I have: my_module.admin: path: '/admin/my_module' defaults: ...
JAyenGreen's user avatar
1 vote
1 answer
619 views

How to get parameter from dynamic route in route subscriber

I am trying to restrict access for non admin users on admin/structure/menu so that only admins can create any new links via admin/structure/menu. Now I want that for one special menu with the ID "...
macbert's user avatar
  • 333
1 vote
0 answers
92 views

View with a path of api/VERSION/foo/bar/%node - %node is not being upcast to a Node object

I am trying to create a handful of Views with a REST Export display. They have paths set behind 'api/.../.../.../%node' where %node will be an ID sent to the request to be upcasted. The basic View has ...
Kevin's user avatar
  • 27.7k
0 votes
0 answers
248 views

How to get node information in RouteSubscriberBase::alterRoutes

what I'm trying to achieve is, for some specific nodes, to set the admin theme. How can I get node information in this class? class RouteSubscriber extends RouteSubscriberBase { /** * {@...
Bohus Ulrych's user avatar
0 votes
1 answer
419 views

How can I override a displayed node with the content rendered by a custom module?

I have a path /application, which is rendered by a custom module (through a combination of theme hook/controller/routing/twig). It's basically a mini-application. I also have a Drupal node /data, ...
Anton's user avatar
  • 273
3 votes
2 answers
198 views

String substitution in Views Contextual filter parameter?

In Drupal 9, I have a View called News. The View is displayed at the following path: /news I can edit it at the following path: /admin/structure/views/view/news/edit It has the following Contextual ...
hotwebmatter's user avatar
  • 2,102
0 votes
0 answers
359 views

How to deal with "Recursive router rebuild detected." exception error

I am frequently seeing module installation and uninstallation fail with the error Uncaught PHP Exception RuntimeException: "Recursive router rebuild detected." at /path/to/drupal/web/core/...
brad.bulger's user avatar
0 votes
1 answer
754 views

How can I make a custom module link appear on /admin/config?

I have a custom module I'm working on and I'd like to make it configurable via the admin menu. I'm having difficulty getting a form to appear in the admin page. Visting admin/config/MYMODULE does show ...
Joseph's user avatar
  • 25
2 votes
1 answer
423 views

Can routing use parameters already in the URL?

I'm actually using D9 to build a system with entities using sub-entities. The main entity system use the following path : /item/{item} Each sub entity is related to a main entity and use this path : /...
titouille's user avatar
0 votes
0 answers
131 views

System updates, now config page errors, drush ends abnormally

After an update failed I'm seeing the following issues. I have tried several things to recover. I do have a database backup, but I am not sure on how to restore using Drush (and I'm concerned because ...
Jason's user avatar
  • 121
1 vote
0 answers
92 views

Custom module routing issue

I've a custom module where I have create the following route: my.custom.route: path: /{someVariable}/my-module/test defaults: _controller: '\Drupal\my_module\Controller\...
Paulo's user avatar
  • 11
0 votes
1 answer
88 views

Is there a way to control how RouteProvider caches a route?

Drupal caches routes in cache_data. This happens in Drupal\Core\Routing\RouteProvider. I am looking at a high traffic website with "interactive" search functionality based on a map. When you ...
sbrattla's user avatar
  • 1,149
2 votes
0 answers
146 views

Add a custom Access callback to the profile module to hide the menu tab for certain users

We are using the Profile module and I'm trying to hide the menu tab on the user's account for certain users based on a value of a field on the user. I have the alterRoute set. namespace Drupal\...
jphelan's user avatar
  • 381
3 votes
3 answers
2k views

AccessDeniedHttpException on a route with _access: TRUE

In my custom module I have a few "publication" routes that do not need any kind of authentication. Months ago I learnt that I could achieve this with the following requirements in routing....
Francesco Marchetti-Stasi's user avatar
0 votes
1 answer
548 views

Route reported as not existing, but I'm not referring to it

Drupal 9.28; I removed some test code, and am now getting the error Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "member.test" does not ...
pglatz's user avatar
  • 459
1 vote
0 answers
75 views

Custom node routing

I have a product content type with alias: /products/headphone. This product page has two url variations: /products/headphone/wire /products/headphone/wireless Both urls should point to the same ...
bdereta's user avatar
  • 141
0 votes
2 answers
336 views

How to add internal path in *.links.menu.yml

I am trying to add an internal link to admin toolbar but I am not able to achieve it. According to documentation we add an internal link in *.links.menu.yml in the below manner but the link is not ...
miststudent2011's user avatar

1
2 3 4 5
47