twig-extension Questions

4

Solved

I'm using Twig lately and I was wondering if it is possible to output the template names which are loaded on the page. The best way I can think of is to display the name above the template itself a...
Vorous asked 2/2, 2016 at 14:48

7

Solved

How can I use an environment variable from the .env file in a custom Twig function (\Twig_SimpleFunction) in Symfony 4?
Prothallus asked 4/3, 2018 at 0:54

4

I am trying to use the bundle JMS Translation but I have this error. It is I guess because my version of twig is not the same the one of the bundle? What to do? CRITICAL - Uncaught PHP Exception T...
Fluent asked 26/2, 2015 at 15:55

1

Solved

I'm currently updating my projects to Symfony 5.1 (where I was previously using Symfony 4.1). When updating I noticed that I can't install the package twig/extensions anymore, which means I can't ...
Silvern asked 4/6, 2020 at 12:7

4

When I try to implement custom Twig Extension in Symfony2-project, I get following error: Unable to register extension "AppBundle\Twig\Extension\FileExtension" as it is already registered. In...
Westfahl asked 3/9, 2017 at 17:47

2

Solved

The Intl extension is an extension for Twig that adds the localizeddate, localizednumber and localizedcurrency filters. How can I install and set up the extension so that I can use those filters in...
Jeffjeffcoat asked 20/9, 2014 at 12:39

1

Solved

I have a decimal number with 4 digits and a scale of 4. (Max is 0.9999 and min is 0.0000) I'm using Twig and its intl extension. When I want to render a percent number, decimals are rounded. {% s...
Pasquale asked 1/11, 2019 at 16:54

3

Solved

I need to override the standard Twig trans filter for my own purposes, i.e I want to get my translations from a custom storage. I tried to figure it out in the docs. But there is no details about t...
Inherited asked 23/1, 2015 at 10:24

1

Solved

In Symfony 4.1 I created an twig extension and I tried to use it as an service twig.extension.active.algos: class: App\Twig\AppExtension public: true tags: - { name: twig.extension, priority: ...
Pellitory asked 18/7, 2018 at 15:12

2

Solved

I want to use nochso/html-compress-twig extension to compress all html, inline css and js.But it is the first time that I register a new extension on Twig and I am bit confused about where I should...
Cru asked 14/10, 2017 at 6:46

2

Solved

In Timber is this function {{post}} where you get things like {{post.post_title}} but there are other functions in WordPress like get_the_permalink(); which are not accessible from post.ge...
Marchand asked 5/10, 2017 at 20:8

1

I am getting this error when using the "field collection" module : Twig_Sandbox_SecurityError: Calling "uri" method on a "Drupal\field_collection\Entity\FieldCollectionItem" object is not allowed...
Jaundiced asked 17/10, 2016 at 16:26

4

Solved

How can I have a global variable in symfony template? I did read this but I prefer to fetch parameter from database, I think this service will be loaded on startup before it can fetch anything from...
Monicamonie asked 15/1, 2015 at 14:32

3

how to get days diffrence from current day. tweetedAt: "2015-02-22 09:56:42". twig {% for key,value in data.about %} {% set tweets_date=(value.tweetedAt|date).date("now").format('%a') %} {% en...
Prefrontal asked 15/6, 2015 at 7:32

2

Solved

I'd like to know if it's possible to have {filename}.html generated for every {filename}.html.twig? I know one solution is to copy and paste the source code from the browser, but is there a more ef...
Sponge asked 28/7, 2016 at 19:49

1

Solved

I'm trying to add some images dynamically with Twig. So I defined a new Twig function called setImgService which basically chechs for a service name and depending on it, it will return some HTML co...
Ottilie asked 13/6, 2016 at 19:36

3

Solved

I want to automatically wrap some html, lets say <span data-id=".."> when I call {{ product.name }} in my twig template. So when in a twig template, I use {{ product.name }}, I want the out...
Allspice asked 10/12, 2015 at 13:11

1

Solved

I have a Twig template (.html file) that I want to render (replace the tokens with values from my PHP file). Instead of sending the rendered result to a browser, however, I want to write it to a ne...
Smallish asked 2/10, 2015 at 7:29
1

© 2022 - 2024 — McMap. All rights reserved.