Skip to content

Translator is required for form_widget even when tranlsation is disabled. #27589

@QuentinCurtet

Description

@QuentinCurtet

Symfony version(s) affected: 4.1 and prior (since 6 years i think)

Description
When the translation is disabled (and the translator component not even install) and use a ChoiceType input in your form, we get the following exception :
Uncaught PHP Exception InvalidArgumentException: "The helper "translator" is not defined."

How to reproduce

  • Unistall translator component
  • Disable translation in the framework.yaml
  • Create a form with ChoiceType input
  • Set the choice_translation_domain to false

Possible Solution
In the file choice_widget_options.html.php on line 3, it would be nice to add a test on the existence of the translator component. Or check if the enable translator option in conf is set to false.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions