minor #19574 [TwigBundle] Add a check for choice's attributes emptiness before calling block('attributes') (Evgeniy Tetenchuk, johnatannvmd)
This PR was merged into the 2.7 branch. Discussion ---------- [TwigBundle] Add a check for choice's attributes emptiness before calling block('attributes') | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Remove unnecessary block calling for choices without "choice_attr" option. This check gain the performance on a large datasets. Previous Pull to master #19527 Commits -------bf6748d
Move space from the before 'if' to the after 'if'd1cf4d1
[TwigBundle] Add a check for choice's attributes emptiness before calling block('attributes')
This commit is contained in:
commit
f12d2b75f3
@ -79,8 +79,7 @@
|
|||||||
{{- block('choice_widget_options') -}}
|
{{- block('choice_widget_options') -}}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{% set attr = choice.attr %}
|
<option value="{{ choice.value }}"{% if choice.attr %} {% set attr = choice.attr %}{{ block('attributes') }}{% endif %}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
|
||||||
<option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
|
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{%- endblock choice_widget_options -%}
|
{%- endblock choice_widget_options -%}
|
||||||
|
Reference in New Issue
Block a user