tc / twig-default-bundle
TcTwigDefaultBundle
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: ~2.3
- symfony/twig-bundle: ~2.3
This package is not auto-updated.
Last update: 2025-03-01 19:47:35 UTC
README
Adds a set_default
tag to twig, which will only set a variable if it doesn't already exist.
Installation
composer require tc/twig-default-bundle
Enable the bundle in your AppKernel.php
$bundles = array( // ... new Tc\Bundle\TwigDefault\TcTwigDefaultBundle(), // ... );
Usage
Usage in Twig:
{% set_default title = 'One' %} {# title = One #} {% set title = 'Two' %} {# title = Two #} {% set_default title = 'Three' %} {# title = Two #}
License
TcTwigDefaultBundle is licensed with the MIT license.
See LICENSE for more details.