There is problem with units in drupal: there are many duplicated modules that do sometimes same job and don't work together.
MoneyCCK field is great that it allows to setup combo widget with field value and field unit. Only problem with it that it doesn't allow to work with other types of units than currencies, which is pity.
How about joining forces to make single bundle: Units API that would provide API for plugging in new unit types, their properties, operations and display settings, and Units CCK (or some better name) module that would use Units API to fetch data and provide fields, widgets, and formatters.
Then it would be needed to provide starter plugins for different units, including units of measurment, currencies, percentages, and whatever.
API would be simple enough. Something like your current hook_unitsapi() but better, with more properties e.g.:
- short unit name
- full unit name
- description
- precision settings
- is_convertable
- convert callback
- display settings (callback ?)
for example, "km" or "USD"
Something like "kilometer" or "United States Dollar"
Optional description
How does one calculate this unit
(boolean) is unit convertable or not. Some units are not convertable, so we need this.
callback which to call when converting this unit
something like display pattern or micro theming function
Do you like this idea ?
Comments
Comment #1
crea commentedI decided to make such bundle myself. Please let me know if you'd like to participate.
Comment #2
crea commentedSee MVF and Units