Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
8b713632
Commit
8b713632
authored
Dec 12, 2013
by
nergal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extension support to yii\twig\ViewRenderer
parent
839650a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
ViewRenderer.php
extensions/yii/twig/ViewRenderer.php
+11
-0
No files found.
extensions/yii/twig/ViewRenderer.php
View file @
8b713632
...
...
@@ -28,6 +28,11 @@ class ViewRenderer extends BaseViewRenderer
public
$cachePath
=
'@runtime/Twig/cache'
;
/**
* @var array extentions list.
*/
public
$extensions
=
[];
/**
* @var array Twig options
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
*/
...
...
@@ -45,6 +50,12 @@ class ViewRenderer extends BaseViewRenderer
$this
->
twig
=
new
\Twig_Environment
(
$loader
,
array_merge
([
'cache'
=>
Yii
::
getAlias
(
$this
->
cachePath
),
],
$this
->
options
));
if
(
!
empty
(
$this
->
extensions
))
{
foreach
(
$this
->
extensions
as
$extension
)
{
$this
->
twig
->
addExtension
(
new
$extension
());
}
}
$this
->
twig
->
addFunction
(
'path'
,
new
\Twig_Function_Function
(
function
(
$path
,
$args
=
[])
{
return
Html
::
url
(
array_merge
([
$path
],
$args
));
...
...
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