Skip to content

Commit 0d6d830

Browse files
committed
bug #25233 [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme (julienfalque)
This PR was merged into the 2.7 branch. Discussion ---------- [TwigBridge][Form] Fix hidden currency element with Bootstrap 3 theme | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - When using a `MoneyType` field, one can pass `currency=false` option to hide the currency symbol. This does not work well when using the Bootstrap 3 theme: the symbol is not displayed but HTML elements that are supposed to contain it are still rendered. Commits ------- c5af7fd938 Fix hidden currency element with Bootstrap 3 theme
2 parents 92981dc + 4ca2c82 commit 0d6d830

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Resources/views/Form/bootstrap_3_layout.html.twig

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@
2020
{%- endblock %}
2121

2222
{% block money_widget -%}
23-
<div class="input-group">
24-
{% set append = money_pattern starts with '{{' %}
25-
{% if not append %}
26-
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
27-
{% endif %}
23+
{% set prepend = not (money_pattern starts with '{{') %}
24+
{% set append = not (money_pattern ends with '}}') %}
25+
{% if prepend or append %}
26+
<div class="input-group">
27+
{% if prepend %}
28+
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
29+
{% endif %}
30+
{{- block('form_widget_simple') -}}
31+
{% if append %}
32+
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
33+
{% endif %}
34+
</div>
35+
{% else %}
2836
{{- block('form_widget_simple') -}}
29-
{% if append %}
30-
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
31-
{% endif %}
32-
</div>
37+
{% endif %}
3338
{%- endblock money_widget %}
3439

3540
{% block percent_widget -%}

0 commit comments

Comments
 (0)