From a46d436db31261e25942af8c84b00fc820783f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Tue, 2 Jul 2024 16:04:28 +0200 Subject: [PATCH] Fixed `translation_domain` working incorrectly for dropdowns --- .../themes/admin/ui/component/dropdown/dropdown.html.twig | 5 +++-- .../themes/admin/ui/form_fields/dropdown_widget.html.twig | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bundle/Resources/views/themes/admin/ui/component/dropdown/dropdown.html.twig b/src/bundle/Resources/views/themes/admin/ui/component/dropdown/dropdown.html.twig index 6ed7168765..b9958bb301 100644 --- a/src/bundle/Resources/views/themes/admin/ui/component/dropdown/dropdown.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/component/dropdown/dropdown.html.twig @@ -11,6 +11,7 @@ {% set min_item_width = min_item_width|default(100) %} {% set custom_form = custom_form is defined ? custom_form : true %} {% set translation_domain = translation_domain|default(false) %} +{% set choice_translation_domain = choice_translation_domain|default(false) %} {% set value = value is defined ? value : null %} {% set multiple = multiple|default(false) %} {% set no_items = choices_flat|length == 0 %} @@ -85,7 +86,7 @@ {% include selected_item_template_path with { value: first_choice.value, - label: _self.get_translated_label(first_choice.label, translation_domain), + label: _self.get_translated_label(first_choice.label, choice_translation_domain), icon: first_choice.icon is defined ? first_choice.icon, } %} {% endif %} @@ -95,7 +96,7 @@ {% if custom_form ? choice.value == value : choice is selectedchoice(value) %} {% set label = selected_item_label is defined ? selected_item_label - : _self.get_translated_label(choice.label, translation_domain) + : _self.get_translated_label(choice.label, choice_translation_domain) %} {% include selected_item_template_path with { diff --git a/src/bundle/Resources/views/themes/admin/ui/form_fields/dropdown_widget.html.twig b/src/bundle/Resources/views/themes/admin/ui/form_fields/dropdown_widget.html.twig index 70dc38cf11..1dbd551a60 100644 --- a/src/bundle/Resources/views/themes/admin/ui/form_fields/dropdown_widget.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/form_fields/dropdown_widget.html.twig @@ -17,7 +17,8 @@ multiple: form.vars.multiple, custom_init: attr.dropdown_custom_init|default(false), class: attr.dropdown_class|default(''), - translation_domain: choice_translation_domain|default(false), + choice_translation_domain: choice_translation_domain|default(false), + translation_domain: translation_domain|default(false), custom_form: false, is_disabled: attr.disabled|default(false) or disabled|default(false) or dropdown_disabled|default(false), is_hidden: attr.dropdown_hidden|default(false),