Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
222
Merge Requests
222
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
be3b5337
Commit
be3b5337
authored
Jul 28, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2539258
by cilefen: Inject the cache bin into TwigEnvironment
parent
e19e8efd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
core/core.services.yml
core/core.services.yml
+1
-1
core/lib/Drupal/Core/Template/TwigEnvironment.php
core/lib/Drupal/Core/Template/TwigEnvironment.php
+5
-3
No files found.
core/core.services.yml
View file @
be3b5337
...
...
@@ -1418,7 +1418,7 @@ services:
class
:
Drupal\Core\Extension\InfoParser
twig
:
class
:
Drupal\Core\Template\TwigEnvironment
arguments
:
[
'
@app.root'
,
'
@twig.loader'
,
'
%twig.config%'
]
arguments
:
[
'
@app.root'
,
'
@
cache.default'
,
'
@
twig.loader'
,
'
%twig.config%'
]
tags
:
-
{
name
:
service_collector
,
tag
:
'
twig.extension'
,
call
:
addExtension
}
twig.extension
:
...
...
core/lib/Drupal/Core/Template/TwigEnvironment.php
View file @
be3b5337
...
...
@@ -8,6 +8,7 @@
namespace
Drupal\Core\Template
;
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\Core\Cache\CacheBackendInterface
;
use
Drupal\Core\PhpStorage\PhpStorageFactory
;
use
Drupal\Core\Render\SafeString
;
...
...
@@ -36,14 +37,15 @@ class TwigEnvironment extends \Twig_Environment {
*
* @param string $root
* The app root.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache
* The cache bin.
* @param \Twig_LoaderInterface $loader
* The Twig loader or loader chain.
* @param array $options
* The options for the Twig environment.
*/
public
function
__construct
(
$root
,
\
Twig_LoaderInterface
$loader
=
NULL
,
$options
=
array
())
{
// @todo Pass as arguments from the DIC.
$this
->
cache_object
=
\
Drupal
::
cache
();
public
function
__construct
(
$root
,
CacheBackendInterface
$cache
,
\
Twig_LoaderInterface
$loader
=
NULL
,
$options
=
array
())
{
$this
->
cache_object
=
$cache
;
// Ensure that twig.engine is loaded, given that it is needed to render a
// template because functions like TwigExtension::escapeFilter() are called.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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