Symfony (6.* and 7.*) complains about missing "You have requested a non-existent parameter "twig.form.resources"
Hi all,
I was trying to use this great bundle with my Symfony application. Unfortunately, my installation complains that there is no parameter called "twig.form.resources", which is requested in line 41 of DependencyInjection/GregwarCaptchaExtension.php
/** @var array<string> $resources */
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources', array_merge(array('@GregwarCaptcha/captcha.html.twig'), $resources));
According to Twig's configuration guide there is only a configuration parameter form_themes.
So I forked this repository, removed the lines:
$resources = $container->getParameter('twig.form.resources');
$container->setParameter('twig.form.resources', array_merge(array('@GregwarCaptcha/captcha.html.twig'), $resources));
and added "@GregwarCaptcha/captcha.html.twig" to my twig configuration as additional form_theme:
twig:
default_path: '%kernel.project_dir%/templates'
paths:
'assets/images': images
'assets/css': styles
debug: '%kernel.debug%'
exception_controller: null
form_themes:
- 'bootstrap_3_horizontal_layout.html.twig'
- 'Form/fields.html.twig'
- '@SonataForm/Form/datepicker.html.twig'
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
- '@GregwarCaptcha/captcha.html.twig'
globals:
paypal_client_id: '%app.paypal_api_client_id%'
file_name_pattern: '*.twig'
Once done, everything works as expected.
Now I am wondering, if I am the only one having this isssue or if this is a general problem?
Any help would be appreciated.
Best
Christian
Same issue here
You can fix it by putting Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true], at the end of your bundles.php file, so the twig.form.resources will exist.