Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MoneyField: Move field generation from constructor to custom method #11153

Closed
4 tasks done
beerbohmdo opened this issue Feb 19, 2024 · 1 comment
Closed
4 tasks done

Comments

@beerbohmdo
Copy link
Contributor

beerbohmdo commented Feb 19, 2024

Description

The MoneyField is a CompositeField which contains two fields, a DropdownField/HiddenField/TextField for the currency and a NumberField for the Amount. The first is already created inside a buildCurrencyField() method. The amount Field is directly created inside the constructor.

I would suggest to move the generation of the Amount field into a method also. This makes the class more extensible.

My use case is that I wanted to store the Money as full integer instead decimal, like my (and the most other) payment provider does. So I had to replace the internal NumericField with my own.

Additional context or points of discussion

In this PR #11150 I already made that change.

Validations

  • You intend to implement the feature yourself
  • You have read the contributing guide
  • You strongly believe this feature should be in core, rather than being its own community module
  • You have checked for existing issues or pull requests related to this feature (and didn't find any)

PRs

@GuySartorelli
Copy link
Member

The linked PR has been merged. This will be included in the Silverstripe CMS 5.2.0 release in April.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants