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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
c84b3e0e
Commit
c84b3e0e
authored
Jun 19, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3767 from grachov/patch-1
Twig extensions were added twice
parents
35312c5c
b8836987
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
CHANGELOG.md
extensions/twig/CHANGELOG.md
+1
-1
ViewRenderer.php
extensions/twig/ViewRenderer.php
+2
-9
No files found.
extensions/twig/CHANGELOG.md
View file @
c84b3e0e
...
...
@@ -6,7 +6,7 @@ Yii Framework 2 twig extension Change Log
-
Bug #2925: Fixed throwing exception when accessing AR property with null value (samdark)
-
Enh #1799: Added
`form_begin`
,
`form_end`
to twig extension (samdark)
-
Fixed multiple adding of extensions from the config, added support for the instantiated extensions (grachov)
2.
0.0-beta April 13, 2014
-------------------------
...
...
extensions/twig/ViewRenderer.php
View file @
c84b3e0e
...
...
@@ -56,7 +56,7 @@ class ViewRenderer extends BaseViewRenderer
public
$filters
=
[];
/**
* @var array Custom extensions.
* Example: `['Twig_Extension_Sandbox',
'Twig_Extension_Text'
]`
* Example: `['Twig_Extension_Sandbox',
new \Twig_Extension_Text()
]`
*/
public
$extensions
=
[];
/**
...
...
@@ -84,13 +84,6 @@ class ViewRenderer extends BaseViewRenderer
'charset'
=>
Yii
::
$app
->
charset
,
],
$this
->
options
));
// Adding custom extensions
if
(
!
empty
(
$this
->
extensions
))
{
foreach
(
$this
->
extensions
as
$extension
)
{
$this
->
twig
->
addExtension
(
new
$extension
());
}
}
// Adding custom globals (objects or static classes)
if
(
!
empty
(
$this
->
globals
))
{
$this
->
addGlobals
(
$this
->
globals
);
...
...
@@ -198,7 +191,7 @@ class ViewRenderer extends BaseViewRenderer
public
function
addExtensions
(
$extensions
)
{
foreach
(
$extensions
as
$extName
)
{
$this
->
twig
->
addExtension
(
new
$extName
());
$this
->
twig
->
addExtension
(
is_object
(
$extName
)
?
$extName
:
new
$extName
());
}
}
...
...
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