{# here isn't need to create the expected `icon_choice_widget` like shown the documentation, because this looks equal to `choice_widget` from `ChoiceType`, only we need overwrite the block that renders the label. #} {%- block icon_widget -%} {{ form_widget(form.parent.icon|raw) }} {#{% for group_label, choice in options %} {%- if choice is iterable -%} {% set options = choice %} {{- block('choice_widget_options') -}} {%- else -%} #}{# this line has been overwritten, see {{- block('choice_option_label') -}} to end #}{# {%- endif -%} {% endfor %}#} {%- endblock icon_widget -%} {%- block choice_option_label -%} {# this block has been called from choice_widget_options block #} {%- if raw_label|default(false) -%} {# the label is rendered as raw when IconChoiceType is used #} {{ choice_translation_domain is same as(false) ? choice.label|raw : choice.label|trans({}, choice_translation_domain)|raw }} {%- else -%} {{ choice_translation_domain is same as(false) ? choice.label|raw : choice.label|trans({}, choice_translation_domain)|raw }} {%- endif -%} {%- endblock -%}