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
  • for example, "km" or "USD"

  • full unit name
  • Something like "kilometer" or "United States Dollar"

  • description
  • Optional description

  • precision settings
  • How does one calculate this unit

  • is_convertable
  • (boolean) is unit convertable or not. Some units are not convertable, so we need this.

  • convert callback
  • callback which to call when converting this unit

  • display settings (callback ?)
  • something like display pattern or micro theming function

Do you like this idea ?

Comments

crea’s picture

I decided to make such bundle myself. Please let me know if you'd like to participate.

crea’s picture

Status: Active » Fixed

See MVF and Units

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.