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
ed25afbd
Commit
ed25afbd
authored
13 years ago
by
Larry Garfield
Browse files
Options
Downloads
Patches
Plain Diff
Move all code to the kernel constructor, not handle method.
parent
0876971e
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/lib/Drupal/Core/DrupalKernel.php
+4
-50
4 additions, 50 deletions
core/lib/Drupal/Core/DrupalKernel.php
with
4 additions
and
50 deletions
core/lib/Drupal/Core/DrupalKernel.php
+
4
−
50
View file @
ed25afbd
...
@@ -48,6 +48,10 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
...
@@ -48,6 +48,10 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
$this
->
dispatcher
=
$dispatcher
;
$this
->
dispatcher
=
$dispatcher
;
$this
->
resolver
=
$resolver
;
$this
->
resolver
=
$resolver
;
$context
=
new
RequestContext
();
$this
->
matcher
=
new
UrlMatcher
(
$context
);
$this
->
dispatcher
->
addSubscriber
(
new
RouterListener
(
$this
->
matcher
));
// @todo Make this extensible rather than just hard coding some.
// @todo Make this extensible rather than just hard coding some.
// @todo Add a subscriber to handle other things, too, like our Ajax
// @todo Add a subscriber to handle other things, too, like our Ajax
// replacement system.
// replacement system.
...
@@ -66,55 +70,5 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
...
@@ -66,55 +70,5 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
$this
->
dispatcher
->
addSubscriber
(
new
ExceptionListener
(
function
(
Exception
$e
)
{
$this
->
dispatcher
->
addSubscriber
(
new
ExceptionListener
(
function
(
Exception
$e
)
{
return
new
Response
(
'A fatal error occurred: '
.
$e
->
getMessage
(),
500
);
return
new
Response
(
'A fatal error occurred: '
.
$e
->
getMessage
(),
500
);
}));
}));
}
/**
*
* @param Request $request
* The request to process.
* @return Response
* The response object to return to the requesting user agent.
*/
function
handle
(
Request
$request
,
$type
=
self
::
MASTER_REQUEST
,
$catch
=
true
)
{
if
(
$type
==
self
::
MASTER_REQUEST
)
{
$matcher
=
$this
->
getMatcher
(
$request
);
$this
->
dispatcher
->
addSubscriber
(
new
RouterListener
(
$matcher
));
}
}
return
parent
::
handle
(
$request
,
$type
,
$catch
);
}
/**
* Returns an EventDispatcher for the Kernel to use.
*
* The EventDispatcher is pre-wired with some event listeners/subscribers.
*
* @todo Make the listeners that get attached extensible, but without using
* hooks.
*
* @return EventDispatcher
*/
protected
function
getDispatcher
()
{
return
$dispatcher
;
}
/**
* Returns a UrlMatcher object for the specified request.
*
* @param Request $request
* The request object for this matcher to use.
* @return UrlMatcher
*/
protected
function
getMatcher
(
Request
$request
)
{
// Resolve a routing context(path, etc) using the routes object to a
// Set a routing context to translate.
$context
=
new
RequestContext
();
$context
->
fromRequest
(
$request
);
$matcher
=
new
UrlMatcher
(
$context
);
return
$matcher
;
}
}
}
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