Twig-CS-Fixer icon indicating copy to clipboard operation
Twig-CS-Fixer copied to clipboard

Unknown 'form_theme' Tag Error with Custom Form Theme

Open JulienRatahiry opened this issue 10 months ago • 1 comments

Hi, I'm having a problem trying to apply a custom form theme in my Symfony project.

When I use the tag {% form_theme form with 'Form/tailwind_2_override_layout.html.twig' %} to define a custom form theme, I get the following error: File is invalid: Unknown "form_theme" tag.

The form adopts the style defined in 'Form/tailwind_2_override_layout.html.twig' but I get the error.

Expected behavior

The form_theme variable should not block twig cs fixer

Actual behavior

An error is generated indicating File is invalid: Unknown "form_theme" tag.

JulienRatahiry avatar Apr 08 '24 11:04 JulienRatahiry

Hi,

Form_theme is already installed, https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/src/Environment/StubbedEnvironment.php#L121-L123 did you have installed symfony/twig-bridge ?

VincentLanglet avatar Apr 08 '24 11:04 VincentLanglet

Hi,

Form_theme is already installed, https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/src/Environment/StubbedEnvironment.php#L121-L123 did you have installed symfony/twig-bridge ?

For other people, the @VincentLanglet answer solved the problem. We had this problem because we installed twig-cs-fixer in a separate directory, as php-cs-fixer recommends.

Thanks @VincentLanglet for your help. My colleague forgot to reply.

vinceAmstoutz avatar May 02 '24 20:05 vinceAmstoutz