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
1answer
71 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 ...
0
votes
1answer
72 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 (...
0
votes
1answer
54 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 ...
0
votes
0answers
33 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 ...
0
votes
0answers
45 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 ...
1
vote
1answer
19 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 ...
0
votes
0answers
15 views

I can't alter the 'entity.media.route'

I want my drupal user to see the media edit form using the frontend-theme, not the admin-theme. In my RouteSubscriber I use if ($route = $collection->get('entity.media.edit_form')) { $route->...
0
votes
0answers
17 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' ...
0
votes
0answers
17 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 ...
0
votes
2answers
61 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 ...
0
votes
1answer
42 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 ...
0
votes
0answers
63 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' ...
0
votes
2answers
80 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::...
0
votes
1answer
49 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 ...
1
vote
2answers
56 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,...
3
votes
1answer
68 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/%...
0
votes
1answer
74 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,...
3
votes
1answer
57 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" ...
0
votes
1answer
148 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\...
0
votes
1answer
80 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 ...
0
votes
1answer
56 views

Is there a way to get the controller class from a Request object or any other service class?

My controller class holds some not-so-easy logic to receive some data from a route parameter I need in a block plugin. As this block will only be rendered on this specific route, I would like to ...
0
votes
1answer
82 views

How do I create dynamic routes where the changing part is at the beginning of the path?

I need to create custom module routes like the following. /ireland-dummy-page (IE) /uk-dummy-page (UK) /dummy-page (global) How can I write the route paths for this scenario? Do I want to write ...
0
votes
0answers
27 views

Route to Url with contextual filters [duplicate]

I'm looking for a way to convert a route to an Url with contextual filters added. I can do it manually and it works, but I still think there should be a better, "Drupalish" way to do it. ...
1
vote
1answer
136 views

Alter existing 'Log In' route so URL includes request_uri as query string

I am trying to alter the existing 'Log In' URL so that it points to a certain location and also includes the REQUEST_URI as a query string that is not encoded. How do I do this? Based on this article,...
4
votes
1answer
169 views

How can I exclude certain routes from maintenance mode?

I am trying to make certain routes exempt from maintenance mode by adding the option _maintenance_access to the route and setting it to TRUE. I think (although I'm not 100%) that this works because in ...
1
vote
1answer
62 views

EventSubscriber returning correct content but status code is 404

As the title says, content is being returned correctly but the status code is 404. I have checked the .htaccess file and the Apache config file as well. All seems to be fine. I have the following in ...
1
vote
1answer
86 views

How can I programmatically get various common user profile related URLs?

I'd like to get the following URLs in Drupal 8: /user/register /user/login /logout /user I already know I can use \Drupal::service('path.current')->getPath() to get the current path. I want to ...
0
votes
1answer
73 views

Altering existing route for translation overview page ie: entity.node.content_translation_overview

I have followed this documentation page : https://www.drupal.org/docs/drupal-apis/routing-system/altering-existing-routes-and-adding-new-routes-based-on-dynamic-ones in attempt to alter access of ...
0
votes
0answers
117 views

Unable to access page when using RouteSubscriber::alterRoutes() to override display for path

Because of a need to be able to combine elements from two different entities - a node and a Commerce product - in one page, I am attempting to implement my own custom controller and override the built ...
1
vote
2answers
571 views

Add custom access check to user page

I would like to add an additional access condition to viewing user pages like user/1. I looked at the following guidelines, but have not succeeded in coming up with a solution. https://www.drupal.org/...
1
vote
1answer
56 views

How can I avoid to return HTML markup for access denied? [duplicate]

I've developed a custom controller that serves as a simple endpoint, POST method. This controller has custom access control. Custom access is done by looking for a header in the HTTP request, by ...
0
votes
0answers
51 views

Access Denied when visiting my custom route

I have a custom module with machine name "mymodule". The mymodule.info.yml file looks like this: name: My module type: module description: 'My first drupal module' core: 8.x Then I have a ...
1
vote
0answers
99 views

Programmatic menu link for a view with contextual filter and no parameters in the path

Related question (my question is when contextual filters are NOT in the path): Generate menu links for a view with contextual filter and parameters in the path In mymodule.links.menu.yml I have ...
1
vote
2answers
436 views

How can I allow the current user to only see their own page?

I created a page in a custom module. I want only the current user to access this page on their behalf. For example, I am using it with ID 51. If I go to : /user/51/tasks I can see this page. If I go ...
0
votes
2answers
28 views

How to determine the route for the add node page of a custom entity type?

I have a node type question that I want users to be able to create rapidly. So, after adding a question, I want them to be redirected to /node/add/question to immediately do it again. This is my code ...
-1
votes
1answer
60 views

Why do I get an error related to a controller when I created a custom module?

I created custom module following the Creating a custom module on Drupal tutorial. The teacher of this tutorial demonstrated how you can create a custom module that displays on the page Hello world. ...
0
votes
0answers
66 views

What is the difference between access method in controller and custom access check

I am trying to create a module with custom access checks. I would like to know what additional features does implementing AccessInterface provide. For example I can check access within the ...
0
votes
1answer
70 views

I'm getting a page not found error when trying to visit my custom form

This is the form that I created using Drupal 8: namespace \Drupal\lookup\Form\lookupForm; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; class lookupform extends FormBase { ...
1
vote
2answers
59 views

How to hide Forums from anonymous users?

I installed Forum module. So, I have 'Forums' link in 'Tools' menu corresponding to the path /forum defined in forum.routing.yml in which access is defined by _permission: 'access content'. In my site,...
0
votes
2answers
163 views

Routing path with Entity Reference field

I'm working on a custom module (my_module) which provides some functionality to a specific paragraph type (my_paragraph) created from the user interface. In my routing file, I have the following ...
0
votes
1answer
21 views

“Route ”ctf.content“ does not exist” when installing custom module

I tried writing my own copy of the skeleton module from https://github.com/sidharrell/D8HWexample.git modules/custom/hello_world, but I thought I'd start by changing the module name and using "ctf" ...
0
votes
1answer
94 views

How to temporarily replace Drupal with static HTML pages?

I'm a JavaScript dev with no Drupal experience. I'm working with a church to redesign their Drupal site after their dev moved on without leaving any notes/documentation/etc. In the meantime, I'd like ...
1
vote
2answers
208 views

How to change Taxonomy admin page title?

I simply need to change the title on the (Drupal 8.8.4) administrative page which lists the existing vocabularies. As far as I know/read, the routing.yml should be modified, shouldn't it? (Is only ...
0
votes
1answer
47 views

Link doesn't appear in configuration

I'm a Drupal 8 newbie writing my first module. I have a functioning yet basic module to learn from. What I'm working on now is for it to get a value from a configuration page. If I go directly to the ...
0
votes
1answer
75 views

How can you get the route name/path of groups?

I am new to Drupal 8. I am working on groups module and want to assign different themes to different groups.So i need route name of groups. how to find route name of groups. Thanks in advance. /** ...
0
votes
0answers
50 views

What causes “Page Not Found” messages with a “null” path as the log message, even when the page is displayed correctly?

Once every four or five pages I visit, I get "Page not found" messages in my log, even though the page is found and displays properly. The errors suggest part of the page path is null. For example, ...
0
votes
2answers
49 views

Creating a route with a form and some content

i have created a route with a form: amu_404_redirect_import.admin: path: '/admin/config/amu_404_redirect_import/upload' defaults: _form: '\Drupal\amu_404_redirect_import\Form\...
1
vote
0answers
49 views

Create a route that redirects users to a path via parameter

I'm working on a custom module that needs to act as a mediator between a third party service and this Drupal site to manipulate some parameters. I've created a route: my_module.process_redirect: ...
0
votes
2answers
62 views

A custom route to an entity form will not pass the entity

I want a custom route to the normal user form. So, I've added an entry to the routing file that directs my custom route to the canonical form of the User entities: my_profile_form: path: '/user/{...
0
votes
0answers
51 views

Adding “.xml” at the end of custom route path

I am trying to create custom route which will look like a xml file like this example.com/my/custom/path.xml and I am getting NGINX 404, it won't even goes to Drupal. I tried to research but I could ...

1
2 3 4 5
46