I want to invert my array so that the categories are first so that I can better manage my foreach later. I managed to achieve it, but merge has removed the same keys. And I should not add value as another item in the array. Default Array: After Merge: ( two records have been deleted :() What is he trying
Tag: twig
Is it possible to make global macros in Twig 3?
I want to upgrade my Twig from very old version (2.x or even 1.x) to 3.3. In old version macros imported in top level template are available in all extened and included templates. And I have a bunch of templates where I need my macros (100+ and many embed blocks). I don’t want to import macros manually in evety template.
cache with dynamic pages
I am currently developing a WEB site on symfony 6 and during production testing I have a problem with the TWIG cache. Indeed, my site includes a page editing feature. So when rendering the first time, the page is rendered correctly. However, if the editor then modifies the page, and I return to the page is still the old version.
Drupal Error 502 bad gateway. When I Access TabPages inside of Content
I’m having this issue with Drupal after an update from Drupal 7 to Drupal 8. The error is the following, when I go to the admin page, I go to content -> filter by -> tab pages -> and try to access a tab page a 502 bad gateway error presents. My question is, someone has encounter with this particular
TwigLoaderFilesystemLoader not found when triggering 404 error
I’m new to OOP and MVC with PHP, and I’m currently learning by making my own custom MVC app for testing purposes. I’m not using Symfony yet, but I’ve integrated Twig and I have a problem with it when I call a 404 error outside a controller, in the two following cases : When requested page doesn’t exist on server
How do I get and set Advanced Custom Fields data as a variable in Timber $context to use in a post query?
I want to get and set the value of an ACF field into a variable in my home.php file and then use this as part of a query. So, for example, if a user enters the word ‘event’ in the the field ‘cat_name’ in the CMS, I wanted to get and set this as a variable and then use this
How to overwrite a html-element but keep the rest of a block?
I am extending a twig-template where i want to replace the line with Twig-template I tried to overwrite the layout_main_navigation by copying everything and changing the class of the div. But i am not happy with that solution as i have to copy and overwrite a lot blocks. How can i achieve replacing the class of the div and overwrite
Convert Looping from php to twig
I want to change the command from php to twig : Answer Here’s one way of doing this https://twig.symfony.com/doc/3.x/tags/for.html
add empty cell in dynamic twig table
Hi I’ve got the following array And I need to convert it into a table using twig, this is what i’ve achieved so far But i need to achieve this instead: This is my code so far: As you can see from the pictures I need to add an empty cell if the dynamic key in the array doesn’t exist,
Custom Twig filter from bundle: Unable to load the runtime
I’ve a small twig custom filter in my project created following https://symfony.com/doc/current/templating/twig_extension.html . As long as it sits in src/Twig, it works as expected. Now I’m trying to move it to a custom bundle (vendor/turbolabit/tli-base-bundle/src/Twig/) to make it reusable. I moved the two files: I tagged it in services.yaml: (I also tried as tags: [twig.extension], even if it would be