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,625
questions
1
vote
0
answers
54
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
36
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
21
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
20
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
75
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 = $...
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
42
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
104
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
68
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
121
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
35
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
65
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 ...
0
votes
1
answer
33
views
Drupal 8 taxonomy block
I have following taxonomy block
block--views-block--related-theme-themes-sitemap.html.twig
I need to get all the taxonomy items in this block and then style them separately.
Following code I was ...
0
votes
0
answers
56
views
Error Search Form (Variable "form" does not exist.) symfony
I would like to create a search form with symfony
I started by creating a form (Form/SearchType.php)
then render it in the Controller (SearchController.php)
then send the render to the viewer to ...