Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony (6.* and 7.*) complains about missing "You have requested a non-existent parameter "twig.form.resources" #243

Open
saoco opened this issue Aug 27, 2024 · 0 comments

Comments

@saoco
Copy link

saoco commented Aug 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant