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
27ac97ef
Commit
27ac97ef
authored
11 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1957156
by Crell, rootatwc: Add a request() method to \Drupal.
parent
2e3c6842
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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.php
+26
-0
26 additions, 0 deletions
core/lib/Drupal.php
with
26 additions
and
0 deletions
core/lib/Drupal.php
+
26
−
0
View file @
27ac97ef
...
...
@@ -121,6 +121,32 @@ public static function service($id) {
return
static
::
$container
->
get
(
$id
);
}
/**
* Retrieves the currently active request object.
*
* Note: The use of this wrapper in particular is especially discourged. Most
* code should not need to access the request directly. Doing so means it
* will only function when handling an HTTP request, and will require special
* modification or wrapping when run from a command line tool, from certain
* queue processors, or from automated tests.
*
* If code must access the request, it is considerably better to register
* an object with the Service Container and give it a setRequest() method
* that is configured to run when the service is created. That way, the
* correct request object can always be provided by the container and the
* service can still be unit tested.
*
* If this method must be used, never save the request object that is
* returned. Doing so may lead to inconsistencies as the request object is
* volatile and may change at various times, such as during a subrequest.
*
* @return \Symfony\Component\HttpFoundation\Request
* The currently active request object.
*/
public
static
function
request
()
{
return
static
::
$container
->
get
(
'request'
);
}
/**
* Returns the current primary database.
*
...
...
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