Twig include twig sub template with variables

Twig
Example how to include a sub twig template and passing objects to the sub template.
1 year ago

Symfony2 Twig display current date

Twig
This example will display the current date in your twig template.
1 year ago

Twig display day anme by date

Twig
Example how to display the day name by provided date.
1 year ago

Symfony2 Twig form label with HTML markup

Twig
Example how to generate correct HTML markup in the form label.
1 year ago

Twig replace text

Twig
Example how to replace text in a string with Twig.
1 year ago

Symfony2 Twig generate url by route name

Twig
1 year ago

Get csrf token in form Symfony2

Twig
Use this code to retrieve the csrf token in the Symfony2 form.
1 year ago

Symfony2 generate csrf token via Form widget

Twig
If your not sure how to generate the CSRF token for your current object that is stated in the form, you can generate the csrf form element by using th...
1 year ago

Twig render data from other controller and action

Twig
This example will get data to use in the twig template that is provided by an other controller and action.
1 year ago

Twig display current date

Twig
With this example you can display the current date in a Twig template.
1 year ago

Twig convert DateTime to date string format

Twig
Example how to convert a PHP DateTime object to a string in Twig.
1 year ago

Twig convert date to localized date

Twig
1 year ago

Twig - how to detect last item in loop

Twig
Example how to detect the last item in a loop in Twig.
1 year ago

Twig Check for partial existence before include

Twig
I am working on a fairly complex multi lingual site that will render different partials based on the html locale. I have a partial structure that wi...
11 months ago

Symfony template generation via doctrine:crud

Twig
There Symfony project. He has Entity/Record.php With the command php bin/console generate:doctrine:crud --entity=AppBundle:Record Create a controlle...
11 months ago

How to get config parameters in Symfony2 Twig Templates

Twig
I have a Symfony2 Twig template. I want to output the value of a config parameter in this twig template (a version number). Therefore I defined the co...
11 months ago

Use loop.index as part of template name to include with Twig?

Twig
I have an array of 3 items so in the following I'm including sub-component.twig 3 times: {% for i in array %} <div class="my-class"> {% ...
11 months ago

SF2 Twig : How to customize rendering of CoolectionType embedded in CollectionType?

Twig
I'm designing an app with a Survey entity. Each survey can have multiple SurveyQuestion entities (CollectionType in form, attribute Survey->questions)...
11 months ago

How to translate labels in symfony forms generated with doctrine:crud

Twig
There Symfony project. He has Entity/Record.php With the command php bin/console generate:doctrine:crud --entity=AppBundle:Record Create a controlle...
11 months ago

How can I detect if a form has any elements left to be rendered?

Twig
Let's say I am using the Symfony Form Component to render a simple form with only two fields (username and email) I am rendering both fields with for...
11 months ago