8000 [Form] Add choice_translation_parameters option for ChoiceType form by VincentLanglet · Pull Request #36851 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Add choice_translation_parameters option for ChoiceType form #36851

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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

8000
Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
VincentLanglet committed Oct 4, 2020
commit 53958d7b8a2526e34606090c4cea47e8763c5a87
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
{%- for child in form %}
{{- form_widget(child, {
parent_label_class: label_attr.class|default(''),
label_translation_parameters: choice_translation_parameters,
label_translation_parameters: choice_translation_parameters|default([]),
translation_domain: choice_translation_domain,
valid: valid,
}) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
{%- for child in form %}
{{- form_widget(child, {
parent_label_class: label_attr.class|default(''),
label_translation_parameters: choice_translation_parameters,
label_translation_parameters: choice_translation_parameters|default([]),
translation_domain: choice_translation_domain,
}) -}}
{% endfor -%}
Expand All @@ -162,7 +162,7 @@
{%- for child in form %}
{{- form_widget(child, {
parent_label_class: label_attr.class|default(''),
label_translation_parameters: choice_translation_parameters,
label_translation_parameters: choice_translation_parameters|default([]),
translation_domain: choice_translation_domain,
}) -}}
{%- endfor -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div {{ block('widget_container_attributes') }}>
{%- for child in form %}
{{- form_widget(child) -}}
{{- form_label(child, null, {label_translation_parameters: choice_translation_parameters, translation_domain: choice_translation_domain}) -}}
{{- form_label(child, null, {label_translation_parameters: choice_translation_parameters|default([]), translation_domain: choice_translation_domain}) -}}
{% endfor -%}
</div>
{%- endblock choice_widget_expanded -%}
Expand Down Expand Up @@ -80,12 +80,12 @@
{%- block choice_widget_options -%}
{% for group_label, choice in options %}
{%- if choice is iterable -%}
<optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans(choice_translation_parameters, choice_translation_domain) }}">
<optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans(choice_translation_parameters|default([]), choice_translation_domain) }}">
{% set options = choice %}
{{- block('choice_widget_options') -}}
</optgroup>
{%- else -%}
<option value="{{ choice.value }}"{% if choice.attr %}{% with { attr: choice.attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if not render_preferred_choices|default(false) and choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans(choice_translation_parameters, choice_translation_domain) }}</option>
<option value="{{ choice.value }}"{% if choice.attr %}{% with { attr: choice.attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if not render_preferred_choices|default(false) and choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans(choice_translation_parameters|default([]), choice_translation_domain) }}</option>
{%- endif -%}
{% endfor %}
{%- endblock choice_widget_options -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"choice_loader",
"choice_name",
"choice_translation_domain",
"choice_translation_parameters",
"choice_value",
"choices",
"expanded",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,43 @@
Symfony\Component\Form\Extension\Core\Type\ChoiceType (Block prefix: "choice")
==============================================================================

--------------------------- -------------------- ------------------------------ -----------------------
Options Overridden options Parent options Extension options
--------------------------- -------------------- ------------------------------ -----------------------
choice_attr FormType FormType FormTypeCsrfExtension
choice_filter -------------------- ------------------------------ -----------------------
choice_label compound action csrf_field_name
choice_loader data_class allow_file_upload csrf_message
choice_name empty_data attr csrf_protection
choice_translation_domain error_bubbling attr_translation_parameters csrf_token_id
choice_value invalid_message auto_initialize csrf_token_manager
choices trim block_name
expanded block_prefix
group_by by_reference
multiple data
placeholder disabled
preferred_choices getter
help
help_attr
help_html
help_translation_parameters
inherit_data
invalid_message_parameters
is_empty_callback
label
label_attr
label_format
label_html
label_translation_parameters
mapped
method
post_max_size_message
property_path
required
row_attr
setter
translation_domain
upload_max_size_message
--------------------------- -------------------- ------------------------------ -----------------------
------------------------------- -------------------- ------------------------------ -----------------------
Options Overridden options Parent options Extension options
------------------------------- -------------------- ------------------------------ -----------------------
choice_attr FormType FormType FormTypeCsrfExtension
choice_filter -------------------- ------------------------------ -----------------------
choice_label compound action csrf_field_name
choice_loader data_class allow_file_upload csrf_message
choice_name empty_data attr csrf_protection
choice_translation_domain error_bubbling attr_translation_parameters csrf_token_id
choice_translation_parameters invalid_message auto_initialize csrf_token_manager
choice_value trim block_name
choices block_prefix
expanded by_reference
group_by data
multiple disabled
placeholder help
preferred_choices help_attr
help_html
help_translation_parameters
inherit_data
invalid_message_parameters
is_empty_callback
label
label_attr
label_format
label_html
label_translation_parameters
mapped
method
post_max_size_message
property_path
required
row_attr
setter
translation_domain
upload_max_size_message
------------------------------- -------------------- ------------------------------ -----------------------

Parent types
------------
Expand Down
0