tc/twig-default-bundle

TcTwigDefaultBundle

v1.0.0 2015-05-08 13:25 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:06:45 UTC


README

Latest Stable Version

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.