Questions tagged [routes]
Using a term introduced in Drupal 8, routes are the paths to which modules respond.
2,304 questions
1 vote
1 answer
80 views
Retrieve route for given path, if one exists
I'm trying to pass a URL to my custom form and check it against any route that exists within the site so that I can perform actions on it based upon my own arbitrary criteria I've checked against the ...
0 votes
2 answers
124 views
How to implement dynamic access requirements for a route?
I have a route defined in module.routing.yml, and I want to add a UI in the module to let the user configure what types of access to allow: Oauth2 JWT Cookie How do I do that, since routing.yml is a ...
0 votes
1 answer
52 views
Dynamic URL using route is not working
My {custom_module}.routing.yml file code is as below: custom_greeting.greeting: path: '/custom-greeting/{name}' defaults: _controller: '\Drupal\custom_greeting\Controller\...
1 vote
1 answer
424 views
Allow the anonymous user access to the user.logout route
Ok, I've tested this against drupal/recommended-project:^8, ^9 and ^10. Nothing else installed. I want anon users to be able to hit /user/logout. That's the requirement. IMO, this code (or a close ...
0 votes
1 answer
149 views
"Route does not exist" in JSON:API for custom entity type
I created a custom entity type using drush generate entity:content. I chose to have bundles, and I added a bundle test_bundle. I can add my custom entities at admin/content as expected. However, when ...
0 votes
1 answer
124 views
How to disable caching of _custom_access callback
My module has several pages which use a custom access callback. The conditions for access may change from call to call so this needs to be checked every time. When I am logged in, the access ...
0 votes
1 answer
191 views
How do I redirect to a different form in a _custom_access routing call
In my D10 application, it is required that I have a parallel user login system separate from the Drupal system (it is a requirement I cannot change). On my routing, I have the following: ...
0 votes
0 answers
34 views
Get current node url in a custom block [duplicate]
I'm trying to embed Discourse comments in Drupal, so I'm tryinig tu use this code snippet in a custom block : <div id='discourse-comments'></div> <meta name='discourse-username' content=...
1 vote
1 answer
177 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 ...
0 votes
1 answer
65 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 ...
-1 votes
1 answer
262 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 -...
0 votes
0 answers
268 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:...
0 votes
2 answers
248 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 ...
0 votes
2 answers
154 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....
1 vote
2 answers
121 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' ...