Twig Symfony2 get Request variable

Twig
I know I can do this: app.request.get('name') ...but how do I do this? app.request.get(twig_var_name) I've tried every obvious solution {{}} () ...
2 years ago

Twig json_encode with entity objects and collections (Symfony3)

Twig
From my controller I pass an array of entities called Tag to the twig file like this: return $this->render('tags/list.html.twig', array( 'tags...
2 years ago

Twig loop through form errors

Twig
A way to loop through the form errors
2 years ago

Can't access every object property in Twig

Twig
I have a News entity with the next properties: text start_date expire_date Here's part of the class: //News.php /** * @ORM\Column(type="string"...
2 years ago

Twig check if there are duplicates

Twig
I'm fairly new to Twig. I'm creating a template where users can set a Google font-family in. They set those font-families for three different options....
2 years ago

Displaying a DateInterval in Twig

Twig
I'm trying to display a DateInterval in Twig using the following code: {{ event.endTime.diff(event.startTime)|date("i's''") }} where event is an En...
2 years ago

How to add class if single tag?

Twig
I have 4 <li></li>, which are showed or not. {% if li == 1 %}{% endif %} How to add class if only one (single) <li></li> is...
3 years ago

Difference between {% include '' %} and {{ include('') }} in Twig

Twig
It's possible to include a file in two different ways: {% include 'fic.html.twig' %} {{ include('fic.html.twig') }} What is the difference betwee...
3 years ago

How group item in for TWIG

Twig
How I can grouping item in list, if I have different items with one ID? I want if loop find two or more items with the same id combine them in to lis...
3 years ago

Sending TWIG output to a zip in Symfony for Templating

Twig
I need to create a system that will be able to output a template (a zip with an index.html with all js, css, img etc files as required) based on a set...
3 years ago

Translate messages inside twig in symfony2

Twig
I'm trying to access to the translations via twig. For example, I have the name of my application inside my Resources/translations/messages.de.yml an...
3 years ago

Symfony 3 override default form rendering

Twig
Symfony's documentation on "custom form rendering" seems vague and misleading. I am attempting to render a custom element on a form, but I'm seeing in...
3 years ago

Twig function return a template

Twig
Is it possible for a twig function to return a twig template? For example class ToTimeExtension extends \Twig_Extension { public function getF...
3 years ago

Symfony assetic - is possible in dev load original files?

Twig
I have project on Symfony 3 with installed assetic. I am using it for merging all css together and minify. Usage in twig template: {% stylesheets f...
2 years ago

Drupal 8 missing data when changing content

Twig
On drupal 8, I created a template as suggested by debug. My code looks like this: {% for key, element in elements if key|first != '#' %} {# eleme...
3 years ago

symfony 3 twig template function if

Twig
this function function test(){ var distance =calculateHaversineFormula({{lat}}, {{lng}},{{ geocode.latitude}}, {{ geocode.longitude }} ); ...
3 years ago

wrap checkboxes with custom html in Twig template using form entity fieldtype (Symfony3)

Twig
I would like to wrap the checkboxes with custom HTML in twig template when Symfony3 renders the form. Instead of this: <input type="checkbox" id=...
2 years ago

Symfony2 multiple forms in one template

Twig
My app consists of Zones that can have many Devices. When viewing a Zone, it needs to display a control for each Device in the Zone. Each Device is ...
3 years ago

Render custom formType option in twig template

Twig
I have this problem in Symfony 2.8: I can't render a custom variable with my query passed to form option. See the below code what i have tried : Thi...
3 years ago

How can i split values with twig using filters

Twig
I have a value inside {{ phone }} that i want to split to be formatted as a phone number with twig filters Example; inside {{ phone }} = '20304050', ...
3 years ago