Questions tagged [twig]
Twig is a modern, fast, flexible, and secure templating engine for PHP. Created for Symfony and adopted by Drupal 8.
twig
10,626
questions
-1
votes
0
answers
31
views
How many Twig Macros are too many? ("Macros as Functional Components") [closed]
Hopefully this is an appropriate location to post this...
I'm bit new to twig/timber/wp/etc.. Recently got specs for a pretty convoluted page design and making functional components from Twig macros ...
1
vote
1
answer
61
views
how can i change a variable after submition in symfony 7
i m trying to change a variable after i click on a submit button after verifying some conditions.
i used normal html forms instead of symfony forms idk if there is any difference.
controller:
#[Route('...
-1
votes
0
answers
40
views
Empty cache and weird first page loads on symfony 7.1
In my symfony 7.1 (php 8.3) application, on the registration page, the first attempt to submit the form always results in a console error message "turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:...
-1
votes
0
answers
25
views
Symfony 4: Overriding Twig's routing functions
I've tried to override path and url functions with the answer there : https://stackoverflow.com/a/72365709/2356946
But it's not overriding functions. I mean, even with forcing getPath to do crazy ...
0
votes
0
answers
21
views
How to translate the automatic Symfony FileType input placeholders or labels?
I'm trying to translate the automatic placeholders or labels for a Symfony FileType.
Specifically, I want to change the text "Escolher ficheiro" e "nenhum ficheiro selecionado" to ...
0
votes
1
answer
77
views
Uncaught Twig\Error\SyntaxError: Unexpected token "string" of value "/"
I have a PHP code and try to convert to twig template file for Opencart with many convertors, but every time code is not working.
Original code:
<?php
$homepage = "/";
$currentpage = $...
1
vote
1
answer
75
views
How to access previous orders of a customer in Twig template?
I am working on a Shopware 6 plugin and need to modify a Twig template to include conversion tracking parameters based on whether a customer has previous paid orders. Specifically, I need to set the ...
0
votes
1
answer
22
views
Symfony 6 search form not working. The end template is not shown
In a search form, the search result cannot be displayed nor are there errors. It automatically returns to the search form and does not go to the Twig page chosen as the destination. Here the code:
#[...
0
votes
0
answers
43
views
How to access ACF option' sub-field outside of the option page?
My homepage has embedded an ACF option page, which included two feature banners.
From dump() of the large feature banner, I got this array (showing parts that are relevant to this q):
array:24 [
.........
0
votes
1
answer
108
views
How to apply a specific class in Twig based on the classes of an element?
I'm working on a Drupal website and trying to apply specific classes in Twig files based on the existing classes of an HTML element. Specifically, I want to apply the 'Card-label' class to the title ...
0
votes
1
answer
75
views
Symfony 7 assets are loaded with wrong context path
I am developing a web application with Symfony 7.0. I have a given UI template (Velzon). There is a public/assets folder as well as a assets on top.
No I have created a simple Controller with the path ...
0
votes
1
answer
101
views
Symfony - NumberFormatter - Format numbers with either two fraction digits or no fraction digit
I render a monetary value in Twig like this:
{{ amount | format_currency('EUR', {fraction_digit: 2, decimal_always_shown: false}, 'fr-FR') }}
If amount has no decimal, I want to render it without ...
1
vote
1
answer
125
views
The twig functions encore_entry_link_tags('app') and encore_entry_script_tags('app') both cause an internal server error
I am setting up a new Pimcore website locally and I can't seem to get the mentioned twig functions to work. I get this error message
When I comment out encore_entry_link_tags('app'), ...
0
votes
0
answers
37
views
Showpare 6 Plugin:String configuration value not updating in Twig template
I'm working on a Shopware 6 plugin and facing an issue where a string configuration value from the config.xml file is not being updated in the Twig template, although boolean values are updating ...
-1
votes
1
answer
67
views
Template not updating language direction when changing language
In base.html.twig, I have the following:
<html lang="{{- app.request.locale -}}" dir="{{- app.request.locale|locale_dir -}}">
Where locale_dir is a custom Twig filter that ...