Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
b97f5a89
Unverified
Commit
b97f5a89
authored
Oct 03, 2016
by
Tieme van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move setting $app['twig.app_variable'] after 'Symfony\Bridge\Twig' check
parent
94f4855b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
src/Silex/Provider/TwigServiceProvider.php
src/Silex/Provider/TwigServiceProvider.php
+13
-13
No files found.
src/Silex/Provider/TwigServiceProvider.php
View file @
b97f5a89
...
@@ -39,19 +39,6 @@ class TwigServiceProvider implements ServiceProviderInterface
...
@@ -39,19 +39,6 @@ class TwigServiceProvider implements ServiceProviderInterface
$app
[
'twig.path'
]
=
array
();
$app
[
'twig.path'
]
=
array
();
$app
[
'twig.templates'
]
=
array
();
$app
[
'twig.templates'
]
=
array
();
$app
[
'twig.app_variable'
]
=
function
(
$app
)
{
$var
=
new
AppVariable
();
if
(
isset
(
$app
[
'security.token_storage'
]))
{
$var
->
setTokenStorage
(
$app
[
'security.token_storage'
]);
}
if
(
isset
(
$app
[
'request_stack'
]))
{
$var
->
setRequestStack
(
$app
[
'request_stack'
]);
}
$var
->
setDebug
(
$app
[
'debug'
]);
return
$var
;
};
$app
[
'twig'
]
=
function
(
$app
)
{
$app
[
'twig'
]
=
function
(
$app
)
{
$app
[
'twig.options'
]
=
array_replace
(
$app
[
'twig.options'
]
=
array_replace
(
array
(
array
(
...
@@ -71,6 +58,19 @@ class TwigServiceProvider implements ServiceProviderInterface
...
@@ -71,6 +58,19 @@ class TwigServiceProvider implements ServiceProviderInterface
}
}
if
(
class_exists
(
'Symfony\Bridge\Twig\Extension\RoutingExtension'
))
{
if
(
class_exists
(
'Symfony\Bridge\Twig\Extension\RoutingExtension'
))
{
$app
[
'twig.app_variable'
]
=
function
(
$app
)
{
$var
=
new
AppVariable
();
if
(
isset
(
$app
[
'security.token_storage'
]))
{
$var
->
setTokenStorage
(
$app
[
'security.token_storage'
]);
}
if
(
isset
(
$app
[
'request_stack'
]))
{
$var
->
setRequestStack
(
$app
[
'request_stack'
]);
}
$var
->
setDebug
(
$app
[
'debug'
]);
return
$var
;
};
$twig
->
addGlobal
(
'global'
,
$app
[
'twig.app_variable'
]);
$twig
->
addGlobal
(
'global'
,
$app
[
'twig.app_variable'
]);
if
(
isset
(
$app
[
'request_stack'
]))
{
if
(
isset
(
$app
[
'request_stack'
]))
{
...
...
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