Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3485117
Commits
3a10d518
Commit
3a10d518
authored
12 years ago
by
Niklas Fiekas
Committed by
Larry Garfield
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Clean-up UrlMatcher.php.
parent
b5d1b095
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/EventSubscriber/RouterListener.php
+1
-1
1 addition, 1 deletion
core/lib/Drupal/Core/EventSubscriber/RouterListener.php
core/lib/Drupal/Core/UrlMatcher.php
+35
-7
35 additions, 7 deletions
core/lib/Drupal/Core/UrlMatcher.php
with
36 additions
and
8 deletions
core/lib/Drupal/Core/EventSubscriber/RouterListener.php
+
1
−
1
View file @
3a10d518
...
...
@@ -46,7 +46,7 @@ public function onKernelRequest(GetResponseEvent $event) {
if
(
HttpKernelInterface
::
MASTER_REQUEST
===
$event
->
getRequestType
())
{
$this
->
urlMatcher
->
getContext
()
->
fromRequest
(
$request
);
$this
->
urlMatcher
->
setRequest
(
$
event
->
getR
equest
()
);
$this
->
urlMatcher
->
setRequest
(
$
r
equest
);
}
if
(
$request
->
attributes
->
has
(
'_controller'
))
{
...
...
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/UrlMatcher.php
+
35
−
7
View file @
3a10d518
...
...
@@ -35,6 +35,9 @@ class UrlMatcher implements UrlMatcherInterface {
*/
protected
$request
;
/**
* Constructor.
*/
public
function
__construct
()
{
// We will not actually use this object, but it's needed to conform to
// the interface.
...
...
@@ -71,10 +74,25 @@ public function getContext() {
return
$this
->
context
;
}
/**
* Sets the request object to use.
*
* This is used by the RouterListener to make additional request attributes
* available.
*
* @param Symfony\Component\HttpFoundation\Request $request
* The request object.
*/
public
function
setRequest
(
Request
$request
)
{
$this
->
request
=
$request
;
}
/**
* Gets the request object.
*
* @return Symfony\Component\HttpFoundation\Request $request
* The request object.
*/
public
function
getRequest
()
{
return
$this
->
request
;
}
...
...
@@ -105,7 +123,7 @@ public function match($pathinfo) {
}
/**
* Get a
d
rupal menu item.
* Get a
D
rupal menu item.
*
* @todo Make this return multiple possible candidates for the resolver to
* consider.
...
...
@@ -121,18 +139,28 @@ protected function matchDrupalItem($path) {
return
menu_get_item
(
$path
);
}
/**
* Converts a Drupal menu item to a route array.
*
* @param array $router_item
* The Drupal menu item.
*
* @return
* An array of parameters.
*/
protected
function
convertDrupalItem
(
$router_item
)
{
$route
=
array
(
'_controller'
=>
$router_item
[
'page_callback'
]
);
// @todo menu_get_item() does not unserialize page arguments when the access
// is denied. Remove this temporary hack that always does that.
if
(
!
is_array
(
$router_item
[
'page_arguments'
]))
{
$router_item
[
'page_arguments'
]
=
unserialize
(
$router_item
[
'page_arguments'
]);
}
// Place argument defaults on the route.
// @todo For some reason drush test runs have a serialized page_arguments
// but HTTP requests are unserialized. Hack to get around this for now.
// This might be because page arguments aren't unserialized in
// menu_get_item() when the access is denied.
!
is_array
(
$router_item
[
'page_arguments'
])
?
$page_arguments
=
unserialize
(
$router_item
[
'page_arguments'
])
:
$page_arguments
=
$router_item
[
'page_arguments'
];
foreach
(
$page_arguments
as
$k
=>
$v
)
{
foreach
(
$router_item
[
'page_arguments'
]
as
$k
=>
$v
)
{
$route
[
$k
]
=
$v
;
}
return
$route
;
...
...
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