I just tried to use the switch tag on a twig template, on a Symfony 5 project and got an error.
switch
Then looked for a solution on the web, found documentation, double checked my syntax, that was correct. Finally, searched the twig vendor folders and didnt' found any switch*.php file.
switch*.php
I guess this is not available by default but can't believe it. Does anyone have an idea?
No, swicth not exists in default Twig installation. To use the switch statement you must implement it by yourself or use a bundle/package like buzzingpixel/twig-switch.
swicth
buzzingpixel/twig-switch
2.1m questions
2.1m answers
60 comments
57.0k users