Skip to content

[Form][Intl] Money type is always in prepend mode #19424

@Th3Mouk

Description

@Th3Mouk

Hello everyone.

I've found something that I don't understand in form, intl components, and bootstrap3 bridge.

I try to render a money field on a Bootstrap3 design, but with the currency symbol after the input.
In UK an amont is render like that £10 but in France 10€.

First of all, in bootstrap bridge, I think there is a mistake, and before making a PR, I prefer to check with you.
As you can see here, when the value prepend is false, the render is prepended.
IMO the test should be

{% if prepend %}

But it doesn't resolve all cases, because doing this, the currency symbol can be anymore prepended.

As you can see here, the function that format currency into string, doesn't take argument to prepend or not the symbol.

Something like that can ba add.

if ($prepend) {
  $ret = $symbol.$value;
} else {
  $ret = $value.$symbol;
}

So finally, the symbol is always prepend in the pattern in the MoneyType code here, because the preg_match always return the same result.

Thanks for your help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions