Questions tagged [routes]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
41 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
48 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
69 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
31 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
21 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
47 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
37 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
28 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
42 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
55 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
245 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
36 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
31 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
46 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
70 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
372 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
21 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
64 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
38 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
82 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
65 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
239 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
76 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
26 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 ...
0
votes
0answers
27 views

Pass rendered markup to redirect route

Drupal 8.7.x I have form that passes the outputted data into a template. This template with the data gets rendered into a string like so: : public function submitForm(array &$form, ...
2
votes
2answers
48 views

How can I add an age validator page?

To access the site, all users (except the logged-in users) need to pass through an age gate. They can only leave the welcome page if they are 18 years or older. I started by adding a session to my ...
3
votes
1answer
198 views

Why does this route work with a slash and not a dash?

I have defined a custom dynamic route that works, but isn't ideal: /** * Defines dynamic routes. */ class GuideUnitRoutes { /** * {@inheritdoc} */ public function routes() { $...
1
vote
1answer
31 views

How does routing order / matches effect performance?

I have all the following GET routes defined in my_module.routing.yml: my_module.members_uid: path: 'users/{user}' my_module.members_uid_gid: path: 'users/{user}/group/{group}' my_module.user....
0
votes
1answer
41 views

Is it possible to invoke cron within a hook or route class?

I'm using the Deploy suite, which requires cron to be run after a deployment is created. However, when I try to execute \Drupal\Core\Cron::run(); from hook_entity_create() or from a route Class, it ...
0
votes
0answers
56 views

503 Service Unavailable error in all pages except added to my route file

I have a D8 web with some views and pages. If I log in with administrator user, all works good. If I log in with a normal user, I get 503 service unavailable error after some seconds of load. It ...
0
votes
1answer
27 views

hook_menu() item never reached?

I have a module where hook_menu() was already used to process ajax calls, like this: function bizaudit_menu() { return [ 'bizaudit/ajax' => [ 'page callback' => '...
0
votes
0answers
32 views

Redirect from a path

I have a routing.yml file with a path which triggers a controller method. When the controller method finishes the operation I want to return user to the page he came from originally. I don't want to ...
0
votes
1answer
44 views

Alter existing route's output formats?

I want to alter the entity.node.canonical route so that when it is accessed using ?_format=json it will return the rendered node in JSON. So far I have created a RouteSubscriber that alters the route ...
0
votes
1answer
76 views

How to write test(s) with specific config to test custom access checks?

I have built a custom module that alters some of the User routes (view, edit, delete) to do 3 things: Forbid account editing, except a user who has 'administer users' permission Forbid account ...
0
votes
1answer
37 views

How to update route cache when saving an entity?

I have added a custom access check to the /user/{user} route: class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ protected function alterRoutes(RouteCollection $...
0
votes
0answers
29 views

How to check “_custom_access” for whole website and not module/path?

example: path: '/example' defaults: _controller: '\Drupal\example\Controller\ExampleController::content' requirements: _custom_access: '\Drupal\example\Controller\ExampleController::...
0
votes
0answers
37 views

Difference between adding single parameter vs adding parameter in entity?

Under custom_changes.routing.yml For argument {first_arg}, I am adding default value under defaults custom_changes.argument: path: '/arg-demo/{first_arg}' defaults: _controller: '\Drupal\...
0
votes
1answer
44 views

How to get list of all keys defined in the routing e.g path, defaults, options etc and how can we add new custom key?

route_with_two_nodes: path: '/foo/{node1}/{node2}' defaults: _controller: '\Drupal\example\Controller\ExampleController::foo' options: parameters: node1: type: entity:node ...
0
votes
1answer
64 views

Scoping an admin link to only show for certain node bundles

I have 2 node content types / bundles, A and B. each A has a relationship with multiple Bs. When on the edit page, node/%/edit, for A, I want to show a link to the list of related B so that an editor ...
0
votes
1answer
101 views

Why is $form array empty when extending FormBase or NodeForm

Why is $form not upcast with the requested bundle's fields for the default Form Mode for GET requests; and with the entities' values for other method requests? My form: namespace Drupal\tam_api\Form;...
1
vote
1answer
44 views

Get unsaved node from route parameter

What I want: In hook_media_presave I want to set a field value according to the same field on the referring node. By the referring node, I mean the node where the media entity is created through an ...

1
2 3 4 5
45