-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Collection Form Label #11819
Comments
This is possible through the form theming, using field-specific overrides for the label of the collection entry: {% form_theme form 'quiz_form.html.twig' %}
{{ form_widget(form) }} {# quiz_form.html.twig #}
{% block _myquiz_answers_entry_label %}
{{ form_label(form, 'Answer ' ~ (form.name + 1)) }}
{% endblock %} |
Ok I see. But I don't see what "myquizz_answer_entry" represent here. When I put "_question_form_availableAnswers_label", it changes the label of the collection, not the label of each form in the collection (i.e. the "Answers available" label in the picture) EDIT: Ah ok, you mean the "entry" part ;) It worked now. Thanks. |
The thing now is that this also replace the "name__label" string in the prototype by "Answer 1", so the new answer added by javascript always have the "Answer 1" label ^^ |
@Vinorcola in my exampke, for the prototype, it would indeed not work ( {# quiz_form.html.twig #}
{% block _myquiz_answers_entry_label %}
{%- if label != '__name__label' -%}
{%- set label = 'Answer ' ~ (name + 1) -%}
{%- endif -%}
{{- form_label(form, label) -}}
{% endblock %} |
Thanks stof. |
This seems to be solved. |
Hi all,
After looking few different solutions, I didn't find what I wanted. It seams there is no simple way to customize the label of a form rendering into a collection (see the image attached). It should be a great idea to add such a functionnality to the form.
As you can see, new inner form label are set right through javascript, but there is no way of configuring the label of pre-set data when editing the collection.
The text was updated successfully, but these errors were encountered: