Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
faba05fc
Commit
faba05fc
authored
Jul 22, 2012
by
Katherine Bailey
Browse files
Cleaning up _current_path() and request() related stuff
parent
6d64268e
Changes
6
Hide whitespace changes
Inline
Side-by-side
core/includes/bootstrap.inc
View file @
faba05fc
...
...
@@ -1632,6 +1632,9 @@ function request(Request $new_request = NULL) {
if
(
$new_request
)
{
$request
=
$new_request
;
}
elseif
(
drupal_container
()
->
has
(
'request'
))
{
$request
=
drupal_container
()
->
get
(
'request'
);
}
return
$request
;
}
...
...
core/includes/path.inc
View file @
faba05fc
...
...
@@ -358,6 +358,9 @@ function drupal_match_path($path, $patterns) {
* @see request_path()
*/
function
current_path
()
{
if
(
drupal_container
()
->
has
(
'request'
))
{
return
drupal_container
()
->
get
(
'request'
)
->
attributes
->
get
(
'system_path'
);
}
return
_current_path
();
}
...
...
core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
View file @
faba05fc
...
...
@@ -69,9 +69,6 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) {
* The Event to process.
*/
public
function
onKernelRequestLanguageResolve
(
GetResponseEvent
$event
)
{
$request
=
$event
->
getRequest
();
$path
=
$this
->
extractPath
(
$request
);
// drupal_language_initialize() combines:
// - Determination of language from $request information (e.g., path).
// - Determination of language from other information (e.g., site default).
...
...
@@ -81,9 +78,6 @@ public function onKernelRequestLanguageResolve(GetResponseEvent $event) {
// prior to front page and alias resolution. When above is decoupled, also
// add 'langcode' (determined from $request only) to $request->attributes.
drupal_language_initialize
();
$path
=
_current_path
();
$this
->
setPath
(
$request
,
$path
);
}
/**
...
...
core/modules/language/language.negotiation.inc
View file @
faba05fc
...
...
@@ -225,7 +225,9 @@ function language_from_url($languages, $args = array()) {
}
list
(
$language
,
$path
)
=
language_url_split_prefix
(
$current_path
,
$languages
);
_current_path
(
$path
);
if
(
$request
)
{
$request
->
attributes
->
set
(
'system_path'
,
$path
);
}
if
(
$language
!==
FALSE
)
{
$language_url
=
$language
->
langcode
;
}
...
...
core/modules/user/user.pages.inc
View file @
faba05fc
...
...
@@ -499,7 +499,6 @@ function user_page() {
if
(
$user
->
uid
)
{
// @todo: Cleaner sub request handling.
$subrequest
=
Request
::
create
(
'/user/'
.
$user
->
uid
,
'GET'
,
request
()
->
query
->
all
(),
request
()
->
cookies
->
all
(),
array
(),
request
()
->
server
->
all
());
request
(
$subrequest
);
return
drupal_container
()
->
get
(
'http_kernel'
)
->
handle
(
$subrequest
,
HttpKernelInterface
::
SUB_REQUEST
);
}
else
{
...
...
index.php
View file @
faba05fc
...
...
@@ -25,11 +25,6 @@
// Create a request object from the HTTPFoundation.
$request
=
Request
::
createFromGlobals
();
// Set the global $request object. This is a temporary measure to keep legacy
// utility functions working. It should be moved to a dependency injection
// container at some point.
request
(
$request
);
// Bootstrap all of Drupal's subsystems, but do not initialize anything that
// depends on the fully resolved Drupal path, because path resolution happens
// during the REQUEST event of the kernel.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment