From ee228f38262bd56e4f2f5b799a9b419f716a4274 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Sat, 18 Jan 2014 18:07:59 +0400 Subject: [PATCH 01/12] Changed examples index.twig and layout.twig support Twitter bootstrap 3 --- examples/application/index/index.twig | 54 ++++++++++++++++++--------- examples/layout/layout.twig | 43 ++++++++++----------- 2 files changed, 58 insertions(+), 39 deletions(-) diff --git a/examples/application/index/index.twig b/examples/application/index/index.twig index 073b41f..22d4dc4 100644 --- a/examples/application/index/index.twig +++ b/examples/application/index/index.twig @@ -1,30 +1,48 @@ {% extends 'layout/layout.twig' %} {% block content %} -
-

{{ translate('Welcome to %sZend Framework 2%s'|format('', '')) }}

-

{{ translate('Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.'|format('', '', 2)) }}

-

{{ translate('Fork Zend Framework 2 on GitHub') }} »

-
+
+

{{ translate('Welcome to %sZend Framework 2%s'|format('', '')) }}

+

{{ translate('Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.'|format('', '', 2)) }}

+

{{ translate('Fork Zend Framework 2 on GitHub') }} »

+
-
+
-
-

{{ translate('Follow Development') }}

-

{{ translate('Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!'|format('', '', '', '', '', '')) }}

-

{{ translate('ZF2 Development Portal') }} »

+
+
+
+

{{ translate('Follow Development') }}

+
+
+

{{ translate('Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!'|format('', '', '', '', '', '')) }}

+

{{ translate('ZF2 Development Portal') }} »

+
+
-
-

{{ translate('Discover Modules') }}

-

{{ translate('The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.'|format('', '')) }}

-

{{ translate('Explore ZF2 Modules') }} »

+
+
+
+

{{ translate('Discover Modules') }}

+
+
+

{{ translate('The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.'|format('', '')) }}

+

{{ translate('Explore ZF2 Modules') }} »

+
+
-
-

{{ translate('Help & Support') }}

-

{{ translate('If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We\'d love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.'|format('', '', '', '')) }}

-

{{ translate('Ping us on IRC') }} »

+
+
+
+

{{ translate('Help & Support') }}

+
+
+

{{ translate('If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We\'d love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.'|format('', '', '', '')) }}

+

{{ translate('Ping us on IRC') }} »

+
+
{% endblock content %} \ No newline at end of file diff --git a/examples/layout/layout.twig b/examples/layout/layout.twig index 965303d..4d38030 100644 --- a/examples/layout/layout.twig +++ b/examples/layout/layout.twig @@ -10,44 +10,45 @@ {% block meta %}{% endblock meta %} - - - + + + + {% block style %}{% endblock style %} - + - - + + + {% block script %}{% endblock script %} - {% block inline %}{% endblock inline %} - + \ No newline at end of file diff --git a/src/ZfcTwig/ModuleOptions.php b/src/ZfcTwig/ModuleOptions.php index 7e0f362..52d3dee 100644 --- a/src/ZfcTwig/ModuleOptions.php +++ b/src/ZfcTwig/ModuleOptions.php @@ -21,6 +21,11 @@ class ModuleOptions extends AbstractOptions */ protected $environmentOptions = array(); + /** + * @var array + */ + protected $globals = array(); + /** * @var array */ @@ -210,5 +215,21 @@ public function getEnvironmentClass() { return $this->environmentClass; } + + /** + * @param array $globals + */ + public function setGlobals($globals) + { + $this->globals = $globals; + } + + /** + * @return array + */ + public function getGlobals() + { + return $this->globals; + } } diff --git a/src/ZfcTwig/Twig/EnvironmentFactory.php b/src/ZfcTwig/Twig/EnvironmentFactory.php index dccfb4b..9be3789 100644 --- a/src/ZfcTwig/Twig/EnvironmentFactory.php +++ b/src/ZfcTwig/Twig/EnvironmentFactory.php @@ -19,7 +19,8 @@ public function createService(ServiceLocatorInterface $serviceLocator) /** @var \ZfcTwig\moduleOptions $options */ $options = $serviceLocator->get('ZfcTwig\ModuleOptions'); $envClass = $options->getEnvironmentClass(); - + + /** @var \Twig_Environment $env */ $env = new $envClass(null, $options->getEnvironmentOptions()); if ($options->getEnableFallbackFunctions()) { @@ -45,6 +46,10 @@ function ($name) use ($helperPluginManager) { $env->setLoader($serviceLocator->get($options->getEnvironmentLoader())); + foreach ($options->getGlobals() as $name => $value) { + $env->addGlobal($name, $value); + } + // Extensions are loaded later to avoid circular dependencies (for example, if an extension needs Renderer). return $env; } From 8593a15a8cf675e72aaf575aad2b314ed00b4358 Mon Sep 17 00:00:00 2001 From: Filip Halaxa Date: Sat, 3 May 2014 09:29:12 +0200 Subject: [PATCH 07/12] Missing $loader property fixed --- src/ZfcTwig/View/TwigRenderer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ZfcTwig/View/TwigRenderer.php b/src/ZfcTwig/View/TwigRenderer.php index bfa1a3b..e536bc1 100644 --- a/src/ZfcTwig/View/TwigRenderer.php +++ b/src/ZfcTwig/View/TwigRenderer.php @@ -29,6 +29,11 @@ class TwigRenderer implements RendererInterface, TreeRendererInterface */ protected $helperPluginManager; + /** + * @var Twig_Loader_Chain + */ + protected $loader; + /** * @var TwigResolver */ From c106c2c6686037d0eae686cfa0d0e94c91694760 Mon Sep 17 00:00:00 2001 From: jonmorrison99 Date: Tue, 8 Jul 2014 16:36:56 -0400 Subject: [PATCH 08/12] Update layout.twig jquery.min.js needs to be loaded before bootstrap.min.js --- examples/layout/layout.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/layout/layout.twig b/examples/layout/layout.twig index 4d38030..92f2662 100644 --- a/examples/layout/layout.twig +++ b/examples/layout/layout.twig @@ -18,8 +18,8 @@ {% block style %}{% endblock style %} - + {% block script %}{% endblock script %} @@ -51,4 +51,4 @@
{% block inline %}{% endblock inline %} - \ No newline at end of file + From 014e113de28e295269e721f16ae48de9337f179f Mon Sep 17 00:00:00 2001 From: kokspflanze Date: Mon, 14 Jul 2014 02:16:26 +0200 Subject: [PATCH 09/12] basePath added in layout.twig --- examples/layout/layout.twig | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/layout/layout.twig b/examples/layout/layout.twig index 92f2662..f03d55c 100644 --- a/examples/layout/layout.twig +++ b/examples/layout/layout.twig @@ -10,18 +10,18 @@ {% block meta %}{% endblock meta %} - - - - + + + + {% block style %}{% endblock style %} - - - - + + + + {% block script %}{% endblock script %} @@ -33,7 +33,7 @@ - Zend Framework 2 {{ translate('Skeleton Application') }} + Zend Framework 2 {{ translate('Skeleton Application') }}