Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
cc93aedb
Commit
cc93aedb
authored
12 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1895984
by sdboyer: Improve new-style controller selection by relying on ContentNegotiation.
parent
dcfdede7
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/CoreBundle.php
+1
-0
1 addition, 0 deletions
core/lib/Drupal/Core/CoreBundle.php
core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php
+8
-1
8 additions, 1 deletion
.../Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php
with
9 additions
and
1 deletion
core/lib/Drupal/Core/CoreBundle.php
+
1
−
0
View file @
cc93aedb
...
...
@@ -199,6 +199,7 @@ public function build(ContainerBuilder $container) {
->
addTag
(
'route_filter'
);
$container
->
register
(
'router_processor_subscriber'
,
'Drupal\Core\EventSubscriber\RouteProcessorSubscriber'
)
->
addArgument
(
new
Reference
(
'content_negotiation'
))
->
addTag
(
'event_subscriber'
);
$container
->
register
(
'router_listener'
,
'Symfony\Component\HttpKernel\EventListener\RouterListener'
)
->
addArgument
(
new
Reference
(
'router'
))
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/EventSubscriber/RouteProcessorSubscriber.php
+
8
−
1
View file @
cc93aedb
...
...
@@ -16,12 +16,19 @@
use
Symfony\Component\HttpKernel\KernelEvents
;
use
Symfony\Component\Routing\Matcher\UrlMatcherInterface
;
use
Symfony\Component\Routing\Exception\ResourceNotFoundException
;
use
Drupal\Core\ContentNegotiation
;
/**
* Listener to process request controller information.
*/
class
RouteProcessorSubscriber
implements
EventSubscriberInterface
{
protected
$negotiation
;
public
function
__construct
(
ContentNegotiation
$negotiation
)
{
$this
->
negotiation
=
$negotiation
;
}
/**
* Sets a default controller for a route if one was not specified.
*
...
...
@@ -31,7 +38,7 @@ class RouteProcessorSubscriber implements EventSubscriberInterface {
public
function
onRequestSetController
(
GetResponseEvent
$event
)
{
$request
=
$event
->
getRequest
();
if
(
!
$request
->
attributes
->
has
(
'_controller'
)
&&
$
request
->
attributes
->
has
(
'_content'
)
)
{
if
(
!
$request
->
attributes
->
has
(
'_controller'
)
&&
$
this
->
negotiation
->
getContentType
(
$request
)
===
'html'
)
{
$request
->
attributes
->
set
(
'_controller'
,
'\Drupal\Core\HtmlPageController::content'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment