All Questions
Tagged with page-controller routes
17 questions
0
votes
1
answer
764
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 ...
1
vote
1
answer
192
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 ...
-1
votes
1
answer
227
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. ...
1
vote
0
answers
211
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
2
answers
370
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\...
0
votes
1
answer
1k
views
Why isn't my controller returning AccessResult::forbidden()?
I'm working on a node access module. I've set up my logic. I can't seem to get my code to return AccessResult::forbidden(). I can't even get \dpm to run in access method. What am I doing wrong? Below ...
0
votes
1
answer
748
views
Pass argument when overriding controller in RouteSubscriber
I am having the issue of overriding the default taxonomy controller /taxonomy/term/{tid}.
I have created my own controller which takes {tid} as a parameter and I want to use it instead, so I overrode ...
0
votes
0
answers
114
views
Assign a controller to all book pages
I am trying to build a module that checks if user session set in all pages of a certain book. if the session is not set it will be set.
I am using a sso system so the user data will come from there, ...
3
votes
1
answer
1k
views
How to add a default controller to the <front> route?
Is it possible to add a default controller to the '<front>' route? There's no default controller defined in system.routing.yml.
I'm trying to get a handle on it by using the following code:
&...
1
vote
3
answers
2k
views
Routing for controller with multilingual enabled
On my Drupal 8 multilingual project, I have made a custom controller which create a basic page, but I can't figure out which parameter I must use in the routing. Is this _locale?
This is the ...
2
votes
2
answers
695
views
What is the best way to verify controller arguments?
For example, I have a path on my site.
Let it be www.mysite.com/year/{year}/month/{month}/day/{day}
Could you clarify me, what is the best way to avoid getting of wrong arguments, such as year/3000/...
4
votes
2
answers
1k
views
How do I define a route and controller for the home page?
A custom module called TSA contains almost all of the functionality for the /tsa subsite on my Drupal 8 multisite.
I want to define a route for http://localhost/tsa/, so that I can serve up dynamic ...
1
vote
1
answer
387
views
how to debug a controller not being run
my code below results in a page not found when I browse to the path. How can I debug what is going wrong? I dont see any errors and I have cleared the cache.
mymodule.content:
path: '/admin/...
1
vote
0
answers
670
views
One route, multiple controllers
How can I go around having a single route that would internally be forwarded to a controller depending on some internal logic. I've looked into dynamic routes but it doesn't help since the route is ...
0
votes
0
answers
399
views
Routing Parameter Directly Passed And Upcast
Has anyone come across a way to both pass a dynamic route parameter as well as upcasting it?
something like:
/module/custom/mymodule/src/Routing/MyRoutes.php
$routes["my.custom.route"] = new Route(
...
2
votes
2
answers
5k
views
Create route that returns XML Feed [closed]
How do I create a page that returns an XML feed?
5
votes
2
answers
3k
views
Take over display of a content type node route
I have a discussion content type. I would like the primary viewing experience (at "discussion/discussion-name") to be a cacheable form using a form mode.
Basically, I'm trying to create something ...