Nested Arrays Issue using Twig

Twig
This has really stumped me, not sure why I cant get it working. I have an a variable called 'posts'. Which contains the following. array(2) { ["data...
7 months 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(),]); ...
7 months ago

Navigation, highlight current page

Twig
I've got a parent layout and derived from that child sites. The parent layout has a navigation, each navigation point represents one child site. How...
7 months ago

Symfony2 - form_start function customise in twig

Twig
Form helpers form_start and form_end are useful in twig: {{ form_start(form) }} {{ form_end(form) }} I can customise some parameters like the metho...
7 months ago

Creating an array within for loop with Twig

Twig
I'm trying to create an array and store values in it within for loop but failed so far. How can I do it with Twig? I've read these but being new in T...
7 months 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...
7 months ago

How to set multi-dimensional array in Twig?

Twig
I'm working on Twig for templating in my Symfony2 project. I need to define a 2 dimensional array. I tried like {% set fields = { {'name': 'descripti...
7 months ago

Accessing eloquent BelongsToMany in twig?

Twig
I am having an issue with relationships in eloquent and loading them in twig templating. I have three tables which are Articles, Users and Authors. Th...
7 months ago

unknow function error when calling twig extension

Twig
I'm looking to create a twig extension but Symfony keeps telling me my function is unknown. Here is my class: <?php namespace AppBundle\Twig\Ext...
7 months ago

Phpunit marks test as "risky" when calling showAction method of ExceptionController

Twig
When trying to test a class which calls the showAction method of ExceptionController (class located at vendor/symfony/symfony/src/Symfony/Bundle/Twig...
7 months ago

Twig: Variable in format function

Twig
I'm passing in a string to login_create_account_label which is: Not a member? %sCreate a Free account%s. And also login_create_account_url which ha...
7 months ago

Getting coordinates upon checking a checkbox

Twig
so I'm doing this school thingy and I'm trying to get the x and y coordinates of looped checkboxes when they are checked and display the X and Y coord...
8 months ago

Twig truncate with read more link

Twig
I want to use the truncate filter of twig. And it works fine. I wanted to use as a third argument a link to read more about the article. But it doe...
8 months ago

How does excerpt work in bolt and what are the accepted parameters?

Twig
I was just going through the default twig theme files in bolt CMS and came across the following lines of code: <p>{{ record.excerpt(300, false...
8 months 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...
8 months ago

symfony2 customize form datetime rendering

Twig
I have a form with a datetime rendered as 5 select inputs d MM YYYY H-i $builder ->add('date', 'datetime', array( ...
7 months ago

Twig add attribute with value in a variable

Twig
Using Drupal 8 I want to print out a field's content into the src attribute. I have the following template for my view: <div class="videoWrapperH...
7 months ago

symfony 3 twig template function if

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

Displaying returned array as radio buttons

Twig
I'm trying to display a set of radio buttons (male or female) on my index page. Within my Form I build the form like this: public function buildForm(...
7 months ago

Symfony translations use always default EN

Twig
I have italian language set on my browser, but symfony localization give me only english translations. How can I get italian strings if i access the p...
7 months ago