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...
10 months 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...
9 months ago

symfony 2.1 set form theme in controller

Twig
Recently I used setTheme function in symfony 2.0 from Symfony / Bridge / Twig / Extension / FormExtension.php, eg: $this->get('twig')->getExte...
10 months 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....
9 months 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...
9 months 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"...
9 months ago

Symfony the same variable for all Twig templates

Twig
I am writing my own CMS using Symfony 3 right now and i have problem with include the same variables in all controllers. For example: I want render ...
10 months ago

Silex render form - ChoiceType

Twig
(and sorry for my English) I am working on a Silex project and I start using the form. Without form, i have something like this : And using the f...
10 months ago

Twig loop through form errors

Twig
A way to loop through the form errors
9 months ago

FOS UserBundle how to add image to registration email twig

Twig
How can I add company log in email twig using FOS UserBundle? I do want to do it with in the twig files and don't want to create a custom mailer class...
9 months ago

Join property values of a list of objects in twig

Twig
Is it possible to join the values of properties of a list of objects for displaying it? Something like: {{ users|join(', ', username) }} Where user...
9 months 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...
9 months ago

Cannot access Eloquent attributes on Twig

Twig
I am trying to access an Eloquent attribute with Twig in Slim, and getting an error. I have a Field and a Type object, and the relationship is as fol...
9 months 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=...
9 months ago

Extends template in Twig with Twig_Loader_String

Twig
I have to render a template with Twig_Loader_String and I need to extend a template, like below: $body='{% extends "/views/path/to/my/template" %} ...
8 months ago

How to use twig rendering for making files?

Twig
I would like to use twig to make js file. These are what I want to do. web/base.js // this is my base file alert("this file is created by " + "{{va...
8 months ago

Symfony 3.2: twig/twig v2.0.0 requires php ^7.0

Twig
I just wanted to install my Symfony 3.2 app on a server with PHP 5.6, and a composer install tells me twig/twig v2.0.0 requires php ^7.0 -> your PH...
8 months ago

Correct way to conditionally hide a content block on certain pages

Twig
What is the best way to hide e.g. a nav bar on certain pages in Timber Twig templates. Have tried wrapping the navbar element in {% if post.title !=...
8 months ago

Grav - skip homepage in menu

Twig
I am making my first Grav website. I'm trying to creating a navigation menu and I'd like it to display links to all visible pages but not the homepa...
8 months ago

How to set up style for all tables in symfony 3 Bootstrap 3/4 twig

Twig
I want to have the same look for all tables and don't set it every time. My view: {% extends 'MyBundle::base.html.twig' %} {% block pageTitle %} I...
8 months ago