Skip to content

Commit

Permalink
Fixed money fields showing clear button when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Oct 21, 2024
1 parent f74f9d5 commit 3c72e5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed a bug where it wasn’t possible to scroll the section select modal when moving entries to a different section. ([#15900](https://github.com/craftcms/cms/issues/15900))
- Fixed a bug where query params in the format of `'<operator> <values>'` weren’t being parsed correctly.
- Fixed a bug `craft\services\Entries::saveSection()` and `craft\services\Volumes::saveVolume()` weren’t respecting predefined UUID values on new models.
- Fixed a bug where Money fields’ were incorrectly showing the clear button when disabled.

## 5.4.8 - 2024-10-15

Expand Down
4 changes: 4 additions & 0 deletions src/templates/_includes/forms/money.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
{% if value is not defined or value is defined and value is empty %}
{% set value = null %}
{% endif %}
{% set disabled = disabled ?? false %}
{% set formattingLocale = formattingLocale ?? craft.app.formattingLocale.id -%}
{% set decimalSeparator = decimalSeparator ?? craft.app.formattingLocale.getNumberSymbol(constant('craft\\i18n\\Locale::SYMBOL_DECIMAL_SEPARATOR')) -%}
{% set groupSeparator = groupSeparator ?? craft.app.formattingLocale.getNumberSymbol(constant('craft\\i18n\\Locale::SYMBOL_GROUPING_SEPARATOR')) -%}
{% set currencyLabel = currencyLabel ?? null %}
{% set showClear = showClear ?? true %}
{# If the input is disabled there is no need to show the clear button #}
{% set showClear = disabled ? false : showClear %}

{% set inputAttributes = {
name: "#{name}[value]",
}|merge(inputAttributes ?? {}) %}
Expand Down

0 comments on commit 3c72e5a

Please sign in to comment.