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
60 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
36 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
37 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
66 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
66 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
39 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
16 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
91 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 ...
0
votes
0answers
90 views

How to limit access to a store page to the store owner?

I created a custom module to create a /store/ID/tasks page https://www.drupal.org/project/commerce How to limit access to this page to the store owner ? If the current user is owner of store ID 76, he ...
0
votes
0answers
46 views

How to limit access to a group page to the group administrator?

I created a custom module to create a /group/ID/tasks page https://www.drupal.org/project/group How to limit access to this page to the group administrator ? If the current user is administrator of ...
1
vote
2answers
381 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
21 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 ...
0
votes
1answer
41 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
49 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
2answers
42 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
40 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
0answers
23 views

No route found for POST

I've been working on a custom rest module for Drupal. I wrote the following Resource class. <?php namespace Drupal\aker_platform\Plugin\rest\resource; /** * Provides a License GET Resource ...
0
votes
2answers
56 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
19 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
0answers
29 views

Callback function for module menu can't be called from another file

I have a module that uses the hook_menu to create an endpoint. It is set up like: my_api.module function my_api_menu() { $items = array(); $items['api/v1/users/test/create-test-users'] = array( ...
0
votes
1answer
53 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
91 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
34 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
27 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
44 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
48 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
47 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
50 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
40 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 ...
0
votes
1answer
38 views

Explicitly passing argument to local action for access check

I'm using the group module, and in a custom module I'm trying to create a local task that will bring you directly to the create page for a particular group content type. My goal is to skip the create ...
0
votes
1answer
43 views

Disable cache on base url for redirecting unauthenticated users

I am trying to redirect unauthenticated users. So anytime an unauthenticated user tries to get to the base url, redirect them to an external url. Currently works, but continues to redirect to the ...
0
votes
1answer
70 views

How to route dynamic routes to a single node while keeping the urls?

I have a node node/1 with the path alias /path. What I want is for /path/* to always behave like you went to /path, but not change the url. So going to /path/test?something=1 should behave identically ...
2
votes
2answers
247 views

Write complex access control in a reusable way

We deal with nodes representing humans with two important properties: mother and father. Your parents as well as your aunts and uncles should get extra permissions, like to see you in a certain view ...
0
votes
0answers
40 views

How to create local task links for referenced entities on a node? [duplicate]

I have a content type, which has three reference fields to three different content types. I want to create secondary task links to those referenced entities. Let's say that I have a Product content ...
0
votes
0answers
49 views

Change system.404 path dynamically based on context

I have a site that makes use of the groups module to denote various locations all with their own content. I'd like to give the ability to programmatically alter the system.404 path depending on the ...
1
vote
2answers
32 views

How to add /admin/people as a tab to a custom menu?

In a custom module (association), I ceated views that are accessible thru tabs: The paths are defined in the views; Adhérents et personnes -> /association (this one is also defined as a menu item) ...
0
votes
1answer
62 views

Alter Existing Route - Bypass/override entity permission

I added a custom access check to a JSON API endpoint so that only users who provide a token can POST/PATCH updates on a media endpoint. I followed this documentation in order to alter an existing ...
1
vote
1answer
92 views

How to run alterRoutes on particular condition ? Does it run on cache clear and not on normal Request?

I am trying to implement a feature where I need to run different flow than default flow while the registering user on the site. I am trying to alter the route of "user password reset" for the for the ...
4
votes
1answer
438 views

Add '?' and '=' characters to query string [duplicate]

I'm trying to pass '?' and '=' symbols to a page using routing.yml company.calc: path: '/form?company={nid}' defaults: _controller: FrameworkBundle:Redirect:redirect _title: 'Calc' ...
0
votes
0answers
28 views

How to replace an unhandled exception page with a custom landing page?

The Drupal website uses the simpleSAMLphp Authentication module, which allows single sign on functionality. When the user is not able to sign in automatically, they are returned to an unhandled ...
1
vote
2answers
68 views

How can I retrieve the current node ID on a custom route?

I have a new route and the yml file looks like this: rsvplist.form: path: '/rsvplist' defaults: _form: '\Drupal\rsvplist\Form\RSVPForm' _title: 'RSVP to this Event' requirements: ...
0
votes
1answer
57 views

How to define frontend theme (non-admin) for a given node tab route?

In my custom module I want to define a new tab associated with nodes. I have my own custom route file with the required definitions and a Links file to make sure the new route will be displayed as a ...
5
votes
1answer
105 views

Is there a way to partially rebuild the router or invalidate a route cache?

I'm using the Groups module (http://dgo.to/group) to set up groups on a SaaS project I'm working on. I've set up a domain field on the groups, allowing groups to have vanity domain. As such, groups ...
1
vote
1answer
69 views

How to store temporary metadata for the remainder of a request?

I am looking for a way to store some additional metadata for the remainder of a request, that should be removed after the request has finished. Sessions or SharedTempStore store persistent data across ...
2
votes
0answers
51 views

How to get module name from a given route object?

In a runtime context, given I have a route object, e.g. from route name user.register, how do I find the path or routing.yml or other definer of the route? Does Drupal or Symfony provide for this? ...
0
votes
3answers
46 views

Can I create a form with a route like this /rooms/{node.alias}/booking?

I'm working on a booking project and I have to create a form for reservations. I have created the accommodation content type and the url_alias for this is: /rooms/[node:title] Example: /node/1 = /...
1
vote
0answers
276 views

Custom module route to config form deleted, now the site is down

So I have a custom module Domaincheck which had an admin configuration form. Since that one is not needed at all, I decided to clean up and delete the form and route. That resulted in a Symfony\...
3
votes
1answer
25 views

404 Not Shown For Custom Module - Drupal 7

In a hook_menu() implementation, I am defining a route for login. function my_account_menu() { $items['login'] = array( 'title' => 'Customer Login', 'page callback' => '...
2
votes
0answers
79 views

How is a response generated?

A generic basic PHP Application using Symfony uses code similar to the following one. $request = Request::createFromGlobals(); $context = new RequestContext(); $context->fromRequest($request); $...
0
votes
1answer
29 views

Forward authenticated user to user.page on /login uri

If an authenticated user navigates to /login on a Drupal 8 site, she gets the "access denied" error. I want the site to redirect that user to /user (route user.page) instead. Unfortunately my ...

1
2 3 4 5
46