Add built-in Field types for Units and Money
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
I built a plugin for Craft CMS 3 called Units which is based on PHP Units of Measure but it wraps a Field around it that's a glorified Number field.
Then I was considering doing the same thing with a Money field, using the PHP Money.
The thing is... Craft Commerce uses both of these libraries to do its thing. So then I was thinking that maybe it made more sense if these Fields (which are pretty universally used data types for many projects) were built into Craft core.
That way instead of Commerce doing its own custom thing for both Units and Money, it could just leverage the core Units and Money fields. And then the base libraries would be available to everyone for Units and Money as well.
The fields would be there for content authors and for Commerce. And in templates people could just do:
craft.units.length()
or
craft.money.usd()
...and plugin developers would have these core libraries with core data types to latch onto as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Craft CMS's existing field and template extension points, along with the PHP Units of Measure and PHP Money libraries referenced in the issue. Done would require a core Units field and Money field, template-facing APIs such as craft.units and craft.money, and a clear path for Commerce and plugins to use them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, content
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100