Twig replace text

Twig
Example how to replace text in a string with Twig.
2 years ago

Get csrf token in form Symfony2

Twig
Use this code to retrieve the csrf token in the Symfony2 form.
3 years ago

how does "{% use %}" work in twig using symfony3?

Twig
I'm trying to use the {% use %} syntax to import the blocks from a child template in my base template as described in http://twig.sensiolabs.org/doc/t...
2 years ago

Symfony2 - Hyperlink to an exterior url retrieved from database using TWIG

Twig
i'm using symfony 2.0.19, and i'm trying to create a hyperlink to an external URL, this URL is retrieved from database, i tried doing this <td>...
2 years ago

Prevent quotes from being converted to HTML entities in twig ternary operator

Twig
The following does not convert the quotes to HTML entities {% for row in files %} <tr data-id="{{ row.id }}"><td>{{ row.name }}</td&...
2 years ago

Can I put html inside a Symfony form button with Twig?

Twig
I'm trying to put html inside a form button with twig like: {{ form_widget(form.jiraStatus, { 'label': '<i class="fa fa-bug"></i>...
2 years ago

Symfony dynamic wildcards in google maps infowindow

Twig
I have a small application in Symfony3 with a google map showing some locations injected from the database. What I am trying to achieve is to place a ...
2 years ago

Can an object tell Twig not to escape output when it is {{ printed }}

Twig
I've got a situation where some variables sent to my Twig templates are plain old variables, so I want them to be html-escaped (as is the default beha...
2 years ago

Forcing the Twig Locale

Twig
I would like to use the Twig template system to template my e-mails. The locale of the e-mail should be based on a user setting, not from the session ...
2 years ago

Symfony-Twig: insert fontawesome icon in a form_widget

Twig
To validate a form I am using a standard: {{ form_widget(form.save, {'attr': {'class': 'btn btn-sm btn-danger'}, 'label': 'Submit form'}) }} I want...
2 years ago

Drupal 8 how to pass a value to menu twig template

Twig
I am new to Drupal, I want to pass domain URL to use in menu.html.twig template. How can I do this. Actually I have a menu of 5 domains all pointing t...
2 years ago

Using twig variable inside load jQuery

Twig
I have a problem with including twig inside load function of jQuery, here is an example: <!-- src/MyBundle/Ressources/views/index.html.twig -->...
2 years ago

How to get the current user in twig extension service [symfony2.8]

Twig
I'm trying to get the current user in my NotificationExtension.php. But the page become very slow to load and I also get this error: Error: Call t...
1 year ago

Find missing "empty" translation in Symfony project

Twig
While checking the logs of my Symfony 2.8 project I came across the following warnings: Translation not found. Context: { "id": "", "domain": "messa...
1 year ago

Twig block USE in IF block

Twig
I render same page in modal and self. I wonder if there is some way to check for some condition and if condition is true not to include header and fo...
1 year ago

Twig: prevent parsing of client-side templates

Twig
I need to output a portion of client-side handlebars templates, which has tags similar to twig's 'say' tags: <script type="text/x-handlebars"&gt...
1 year ago

laravel csrf tokens with Twig

Twig
In Laravel the main app template has the following line <script>window.Laravel = <?php echo json_encode(['csrfToken' => csrf_token(),]); ...
1 year ago

Compare date with a specific one and DateTime to string in Twig

Twig
How can I compare two dates in Twig when the first one comes from the dababase and the second is clear - 2012-12-31? I tried with {% if dom.dueD...
1 year ago

Match sub-string is the twig

Twig
I am developing a new drupal8 website and I can't work out what I am doing wrong! All I need to do is find if a sub-string exists in the variable call...
1 year ago

A solution for grouping items in loop with Timber and Twig

Twig
Often i need to do some tricky layout on dynamic elements like galleries. Here's one example: <ul> <li class="slide"> <img src="im...
1 year ago