for all the entity forms of my Symfony2 app, I’d like all labels to be of the following form: <entity_name>.<field_name>
Having the possibility to change the label afterwards would be cool.
How can I achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The default label’s behavior is defined in the
FieldType:https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php#L55
(note: the FieldType class was deprecated in Symfony 2.1 and removed in Symfony 2.3)
If you want to change the default type’s behavior, you can create an extension:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/AbstractTypeExtension.php