How exactly can I add my custom 'units' for this module?
I installed the required modules
[CCK, Units, Format Number, Formatted Number
***Also you need one or more Units integration modules, that implements unit types]
For the 'units integration module' I installed the /project/currency that adds the worlds currency list in the 'Units' module.
Now, I was hoping there would be a way to 'add' additional units as per my requirement either from MVF or via Units but no such option is available.
I am looking to add units of area - eg: sq ft, sq yards, acre, hectors etc
I have not found any module that implements these for 'units' - only the currency module
It would be nice if you can give a option in the MVF in the 'Available Units' area - similar to 'Allowed Values' in text cck fields.
So the user can either select the values from the 'units' module or define their own right there in the 'Allowed Values'
Comments
Comment #1
crea commentedWell, there are no other modules implementing Unit types, simply because Units is very young module without stable release. I hope that when I make stable release someone may write additional integration modules.
I haven't made UI for adding unit types manually, but it may be implemented in future. It makes sense if one needs just several custom units indeed.
If you don't want to wait, you can study API.txt of Units module and implement hook_define_units() in your custom module. Also you can see how it's done in currency_api.module. Actually it's very simple and no big programming skill is required, only basic knowledge of php.
Moving this as feature request in Units module queue cause its more proper place for such feature.
Actually, user defined units would require storing them in SQL table so it should be implemented in separate module which should then return user-defined units via hook_define_units().
Comment #2
crea commentedComment #3
crea commentedI released first beta so let's hope it will encourage other developers to look at this module :)
Comment #4
alauddin commentedThanks for the update. I will try to workout a hack based on your suggestions.
Also, I have been looking at this http://drupal.org/project/unitsapi and I think is probably the right module to try to integrate with.
Comment #5
ndm commentedI think a big module strong and powerfull is better than many separates modules. As me you must like cck and view, just one module, many possibilities, units must take the same way if this module want to have a futur.
I can help if you want, not really in code but in french translation or in data saving or by think with you.
I can prepare a csv with standards units
-length
-surface
-volume
-energy
-temp
-pression
-speed
But with what format and how integrate?
It's possible to have :
type-name-"pluriel"-reference-conversion-signe-position of sign-list of countries who use it; cases of use
length;meter;meters;;m;after;+*,-gb,-usa;design, travel
length;kilometer;kilometers;meter;1000;km;after;+*,-gb,-usa;geography, travel
length;biology;millimeter;millimeters;meter;0.001;mm;after;*,-gb,-usa;biology, electronic
....
So, i have time to make that, if you want.
Comment #6
crea commentedActually I would prefer that various unit types integrated in different modules (for each category of unit different module). That way there will be no code bloat and anyone will be able to enable only categories of units they need. Unfortunatly I don't have time to maintain such collection (and there are probably thousands of possible unit types), so you will have to wait until someone implements that in a module.
Comment #7
ndm commentedAs you want...
Comment #8
Kristina-2 commentedI'm trying to implement a field to get a users height in 4'11" format. I had to install cck, mvf, units, format_number, and formatted number. I setup the field but it doesn't seem to do what I want. :/
Comment #9
crea commentedPlease open separate issue with details.
Comment #10
crea commentedYou may try to use UnitsAPI integration (details are on Units project page). At the moment I don't have time for developing user-defined (UI based) units module but there is nothing stopping other people from implementing that as separate project.
Comment #11
crea commentedComment #13
akamaus commentedUnitsAPI module contains an XML file describing all the units it knows about. So adding new ones is as easy as editing this file and flushing the cache.