Symfony 3 update roles user with form

Twig
I need some help, I would make a form to change the roles of users in the app. I'm using the "default" bundle security of Symfony 3.1.X. Actually I...
7 months 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...
7 months ago

Ternary operators in Twig php

Twig
Is it possible to use ternary operators in twig template? Now, for adding some class to DOM element depend on some condition I do like this: {%if abi...
7 months ago

Twig: get key of subarray without looping?

Twig
My Twig template is receiving an array that contains a path to an image file. It looks like this: array:1 [ "path/to/images/images.jpg" => arra...
7 months ago

Twig - How to randomise items in the array and loop them?

Twig
How can I randomise items in the array and loop them? {% for item in article.resources|shuffle|slice(1) %} ... {% endfor %} I get this error: ...
7 months ago

Relative paths in twig or absolute in PhpStorm

Twig
I'm new to twig. I'm using it in PhpStorm and have problem with paths. Here is my folder structure: - template /folder/ - main.twig - common...
7 months ago

How to access $_POST in Twig form?

Twig
I'm trying to print the value of the input field 'gameTitle' in Twig. This is my code: <h1>New game</h1> <form method="post" action="...
7 months ago

Twig access object

Twig
i want to access the value of a object inside a twig template. Normally i would get the return like that: echo $lang->get("test"); But how can ...
7 months ago

Getitng a Twig Lang value dynamically

Twig
I have a question about how I can pull a deep nested translation value from Twig dynamically. Here is the setup: I have my translations files in yml...
7 months ago

change date locale in template Keystone.js

Twig
I'm using keystone.js with twig.js as template language. how can i change locale in date? http://keystonejs.com/docs/database/#fieldtypes-date I looke...
5 months ago

Make an Iterable array of objects in PHP for Twig

Twig
I'm trying to pass an array of objects as a parameter for the view rendering. The problem is that when I try to iterate over it and I check if it's it...
5 months ago

How to get assets img url in Symfony controller

Twig
I'm using assets in Symfony 2.7.10 and I want to generate an image url in the controller. In the symfony config.yml file I have added the following ...
5 months ago

Twig translate a string which contains parameter

Twig
In my Twig project I use translation from .yaml files. The text which I need to translate is found in a .html.twig file and says, for example, "My t...
5 months ago

how to check if today is between two dates in Twig?

Twig
I'd like to check if today's date is between two dates from the database. Here's my code. {% if today < room.price_start_date and today > room....
5 months ago

Timber plugin with term (WordPress)

Twig
I have a list of posts with one term assigned for one post. I have 5 terms. I generated a list of the term used. I would like to display only post wi...
5 months ago

Timber Wordpress display post in each category

Twig
I use Timber plugin with Wordpress. I would like to create a loop which display 4 articles in each category. publications.php $context = Timber::get...
5 months ago

Twig template with variable

Twig
My twig template has for loop, and I am trying to add a varable to it. How do I do this? The ('var') needs to be the variable > content. + var + .re...
5 months ago

Twig set default value for input

Twig
Code to set a default value for an input field within Twig.
5 months ago

Highcharts - get visible series name dynamically

Twig
I want to make a function which send dynamically all visible series name in a Highchart instance to a PHP function. For example, in this chart, I wan...
5 months ago

Get letter in array with Timber (twig) and Wordpress

Twig
I would like to create a dictionary with Timber (twig) and Wordpress. I get my array by letter but I need to generate a list of letters : A - B - C -...
5 months ago