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 votes
0 answers
8 views

Zoom module path not recognized [closed]

I built a module that uses the Zoom API to catch calls made by customers that are answered and pull up the relevant info, but I get a "requested page is not found" error whenever I access ...
user avatar
1 vote
1 answer
38 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 ...
user avatar
  • 26.6k
0 votes
1 answer
53 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? ...
user avatar
0 votes
0 answers
43 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 ...
user avatar
1 vote
1 answer
36 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....
user avatar
0 votes
0 answers
13 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: ...
user avatar
1 vote
1 answer
54 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 "...
user avatar
  • 281
1 vote
0 answers
70 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 ...
user avatar
  • 26.6k
0 votes
0 answers
66 views

How to get node information in RouteSubscriberBase::alterRoutes

what I'm trying to achieve, is to for some specific nodes set admin theme. I have defined RouteSubscriberBase but how can I get node information here? This code is not working $node = \Drupal::...
user avatar
-1 votes
1 answer
65 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, ...
user avatar
  • 253
3 votes
2 answers
70 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 ...
user avatar
  • 1,939
0 votes
0 answers
111 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/...
user avatar
0 votes
1 answer
53 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 ...
user avatar
  • 25
2 votes
1 answer
71 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 : /...
user avatar
0 votes
0 answers
51 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 ...
user avatar
  • 121
1 vote
0 answers
49 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\...
user avatar
  • 11
0 votes
1 answer
52 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 ...
user avatar
  • 1,149
1 vote
0 answers
53 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\...
user avatar
  • 351
2 votes
3 answers
282 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....
user avatar
0 votes
0 answers
31 views

The quick-start script in Drupal fails

I am trying to install Drupal v 9.2.9 on my web server. I was informed by core/INSTALL.txt that I could run the script php core/scripts/drupal quick-start It stops the installation prematurely with ...
user avatar
0 votes
1 answer
48 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 ...
user avatar
  • 399
1 vote
0 answers
39 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 ...
user avatar
  • 129
0 votes
1 answer
86 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 ...
user avatar
0 votes
0 answers
81 views

Alter route path within event_subscriber with GET parameters

I know I can alter route path with event_subscriber class AdminRouteModifier extends RouteSubscriberBase { protected function alterRoutes(RouteCollection $collection) { if ($route = $collection-...
user avatar
  • 431
-3 votes
1 answer
123 views

Show the same content with different urls [closed]

I need to show the same content with different urls. I would like to create dynamic routes when saving a node in Drupal 9. Does this seem the right way? Some other solution or similar module. A ...
user avatar
  • 1
0 votes
0 answers
56 views

Custom entity with dynamic paths

I am creating a new entity and would like it to be in the users profile. The path should be "/user/{user-id}/documents/X": /* * links = { * "canonical" = "/user/{user}/...
user avatar
1 vote
1 answer
74 views

How to alter routes defined in route_callbacks?

Usually I alter static routes in routes subscriber: protected function alterRoutes(RouteCollection $collection) { $route = $collection->get('gutenberg.media.load_media'); if ($route) { ...
user avatar
1 vote
1 answer
20 views

How do I add items from from the user module to a menu?

How do I add the core user module links such as My account and Log out to another menu?
user avatar
  • 1,359
1 vote
1 answer
268 views

Inbound path processor is not processing

I'm trying to use an Inbound Path Processor to redirect a path(to a webapp based on this tutorial), but Drupal is not picking it up. I tried the following code to simply redirect every page on the ...
user avatar
2 votes
1 answer
290 views

What is the route for a specific node?

I want to override the user.login route that points to the default login page. I.e. I want that a user who presses the default "Log in" link for the site to be directed to a node that ...
user avatar
  • 14.8k
1 vote
2 answers
82 views

What is best practice for passing routing parameters?

In submitForm() I want to redirect to a controller and pass the form values. The form values are all arrays, btw. Here is submitForm. public function submitForm(array &$form, FormStateInterface $...
user avatar
1 vote
1 answer
121 views

How can I customize the 403 page for specific routes?

On a D9 site, with an existing custom 403 page twig. I've been requested to show a different, variable, message from the "standard one" for a couple of specific routes. I've tried with ...
user avatar
  • 490
0 votes
1 answer
116 views

Controller on /taxonomy/term/{taxonomy_term} route

I have a regular Controller on the taxonomy term page (the original view is disabled). It works all right to show what I want it to show, however, neither its getTitle nor its access is ever called (...
user avatar
  • 632
0 votes
1 answer
125 views

How can I add a dynamic redirect on a 404 hit?

I Created a site and URL that returns a 404 Not Found status on www.xyz.com This creates a loss of link equity to the domain and negatively impacts the ability to compete in organic search results. I ...
user avatar
0 votes
0 answers
171 views

How do I add a custom URL for node/add/{custom-content-type}?

I have a custom content type which I fill up with the help of the Forms Steps module. I want to set custom URL for node/add/{custom-content-type}. I tried using a route subscriber and the following ...
user avatar
  • 351
0 votes
0 answers
86 views

How can I get a route's name if I have the route object?

I have a route object (which may not be the current route's object) and I need to get the route's name, e.g. entity.node.canonical. I don't see any method to get the name directly from the object, nor ...
user avatar
  • 7,133
0 votes
1 answer
25 views

permissions for fillpdf URL

I'm using the FillPDF module and the FillPDF online service to render the PDFs. Everything works fine provided I'm logged in as the site admin; however, when I'm logged in as a std. user, I get an ...
user avatar
1 vote
0 answers
105 views

Alter existing dynamic route to a different route with a User Parameter

In the Open Social distro when you click on an author link it takes you to /user/[uid]/stream. This path is a path to a view. The social_user.routing.yml file includes: path: '/user/{user}/home' ...
user avatar
  • 990
0 votes
0 answers
18 views

How to add code that will run on visiting a URL, in addition to another module that also has code that will run on same URL, & control execution order

I'd like to make a custom module that runs code when a URL is visited and then allows an existing module with code that also runs on same URL. So in the case of the existing module that runs on the ...
user avatar
0 votes
2 answers
140 views

How do I embed an Ionic webapp?

I am building a partially decoupled Drupal 8 site. Drupal hosts all the content, but I also built mobile apps and a webapp in Ionic. The mobile apps are working fine, and now I want to host the ...
user avatar
0 votes
1 answer
200 views

How can I have default field values for the node add form as arguments in the URL?

I have a path in drupal 6, which allow me to add new content with 2 fields completed. For example, path node/add/my_content_type/4/6 means that I am on page /node/add/my_content_type, and first field ...
user avatar
  • 5
0 votes
0 answers
245 views

How do I convert URL parameters to lowercase?

We have a routing.yml file in Drupal 8 which contains the following lines. testmodule.res: path: '/subject/{node}' defaults: _controller: '\Drupal\testmodule\Controller\resController::res' ...
user avatar
  • 19
0 votes
2 answers
382 views

How do I override an entity view controller?

I am trying to override the entity view controller for a commerce product view, so that I can redirect the user based on certain conditions. I am trying to do this through the RouteSubscriber::...
user avatar
  • 151
0 votes
1 answer
166 views

How to write custom access for a route which redirects the user to another route if a condition is true

If I visit example.route.one and certain conditions are fulfilled I want to redirect it to example.route.two OR else access should be allowed. How Can I achieve this? I tried writing the redirection ...
user avatar
  • 1
1 vote
2 answers
238 views

Change the path used by a route dynamically

Taxonomy terms have a canonical path of /taxonomy/term/{taxonomy_term} by default, which displays a View with content tagged with that term. For certain taxonomies I would like to use a different view,...
user avatar
  • 1,227
3 votes
1 answer
134 views

If multiple routes match a path pattern, how can I tell which one would be used?

If multiple routes are returned by something like the following: $route_provider = \Drupal::service('router.route_provider'); $found_routes = $route_provider->getRoutesByPattern('collection/%...
user avatar
  • 41
0 votes
2 answers
201 views

Dynamically change the "access denied page" title and body

This is not a question about changing or preprocessing the twig template of the 403 page. I have a controller with an access function called by the _custom_access key of my route. In some circumstance,...
user avatar
  • 554
3 votes
1 answer
162 views

Creating an API via module routing files that includes csrf verification headers

I am working on migrating a custom API from D7 to D8 and am doing so by using module routing. I have a routing.yml file that looks like so: ytp_user.api.login: path: "/api/v1/user/login" ...
user avatar
0 votes
1 answer
431 views

How to create custom node edit form [closed]

protected function alterRoutes(RouteCollection $collection) { if($route = $collection->get('entity.node.edit_form')) { $route->setDefault('_entity_form', '\Drupal\alerts\Form\...
user avatar
0 votes
1 answer
194 views

Bearer Token in url is not parsed by route

I Installed Drupal 9.1.0 on a VPS running on Ubuntu 20.4 and using Nginx 1.18.0, with Composer 2.0.8. I installed two modules (Token and Devel) and a theme (Barrio) using Composer. I can enable the ...
user avatar

1
2 3 4 5
46