Unit API
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
I love the idea of the UnitsApi module. Unfortunately it isn't the best Drupal citizen. If you look in de issue queue you will see loads of issues asking for support for a specific unit. In my opinion users should be able to provide their own units via the UI.
The plan is to do a rewrite of the module and adding a few submodules. Instead of loading the unit definitions from an XML file each time, it will use entities and allow users to add their own definitions for quantities, units and conversion using the UI. When users indicate that a unit Foo (F) is metric, conversions to and from mF (milliFoo) and kF (KiloFoo) will be done automatically. Conversions between Foo and another unit Bar of the same quantity can be defined by the UI. Such a definitions will create a relation between two unit entities using the relation module. The module should provide full backwards API compatibility with the Units API module.
The list of (sub)modules I'm planning to work on at the moment:
Unit_API
Rewrite of the UnitsApi with full backwards API compatibility. Quantities will be bundles, units will be entities and conversions can be defined using the relationship module. Modules should not only be able to define additional quantities and units by implementing a hook but their should be a hook for additional conversions as well. Conversion relations can be uni- or bidirectional. Most unit conversions can be inverted but some, e.g. currencies, can have another conversion factor depending on the direction of the conversion.
Unit_UI
A UI that allows users to define quantities, units for a quantity and conversions between units of a quantity.
Unit_Field
A field with formatters and optional formatted_field integration.
Unit_Examples
An example module providing example units and conversions.
Unit_Stemmer
A module that hooks into the search_api and provides a stemming processor for unit fields.
This will allow users to search on "10 mm" and find entities with a unit field that has a value of "0.01 meter".
Unit_Facets
A module that builds upon the facets_api and provides a range selector for units.
Users will be able to search for items with a specific field value between 50 centimeters and 5 meters.
The facets should also provide the possibility to let users define a range in Centigrades while the source field contains temperature definitions in Fahrenheit.
Unit_Currency
Currencies are in many ways the same as a unit. Their biggest diference is that the conversion factor differs from time to time. Since modules will be able to define a conversion by implementing a hook, a module doing currency conversions can build upon this idea.
Unit_Parse
This module will provide an interface that lets users choose a field or other property of a certain entity-type. This property will contain a string based representation of a unit. E.g. "5.25 m/s". This module parses such text fields using the Batch API into values that can be fed to a Unit Field.
