bug #19426 [Form] Fix the money form type render with Bootstrap3 (Th3Mouk)

This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fix the money form type render with Bootstrap3

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Part fixing https://github.com/symfony/symfony/issues/19424
| License       | MIT
| Doc PR        | none

There is a confusion between the variable naming, and the result expected.

When prepend variable is false, the currency symbol must be add after the widget.
When the `money_pattern`starts with `{{`, `prepend` variable must be `false`.

Commits
-------

637a441 Fix the money form type render with Bootstrap3
This commit is contained in:
Nicolas Grekas 2016-07-25 18:10:47 +02:00
commit 44da6e8137

View File

@ -21,12 +21,12 @@
{% block money_widget -%} {% block money_widget -%}
<div class="input-group"> <div class="input-group">
{% set prepend = '{{' == money_pattern[0:2] %} {% set append = money_pattern starts with '{{' %}
{% if not prepend %} {% if not append %}
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
{% endif %} {% endif %}
{{- block('form_widget_simple') -}} {{- block('form_widget_simple') -}}
{% if prepend %} {% if append %}
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span> <span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
{% endif %} {% endif %}
</div> </div>