Download the PHP package gloomy/twig-decorator-bundle without Composer
On this page you can find all versions of the php package gloomy/twig-decorator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package twig-decorator-bundle
GloomyTwigDecoratorBundle
ABOUT
This bundle adds 2 tags in twig:
- {% grab %} which injects variables into the template
- {% decorate %} that you can use instead of the {% extends %} tag to determine which layout to use to extend your template, and inject custom variables to each layout.
USAGE
{% grab %}
The bundle comes with 1 grabber:
-
ControllerGrabber
This grabber will be used only to inject variables inside the template from a controller.
{% decorate %}
The bundle comes with 2 decorators:
-
controller
This decorator will be used only to inject variables inside the layout from a controller.
-
xmlhttprequest
This decorator lets you define 2 layouts depending if XmlHttpRequest has been used or not. Then you can choose which variables to inject into each.
All parameters are optionals. Without the _xmlhttprequest parameter, all blocks are printed by default.
You can choose the blocks you want to display with the _blocks parameter
EXTEND
Create your own grabber or decorator.
Grabber
Your class must implement Gloomy\TwigDecoratorBundle\Grabber\GrabberInterface which has only 1 method:
- public function getVariables(array $variables);
Decorator
Your class must implement Gloomy\TwigDecoratorBundle\Decorator\DecoratorInterface which has only 2 methods:
- public function getTemplate(array $variables);
- public function getVariables(array $variables);
Then define a tagged service and use it as the first argument of the {% grab %} or {% decorate %} tag. The tag can be :
LICENSE
MIT
INSTALLATION
1. Install with composer
composer.phar require "gloomy/twig-decorator-bundle" "*"