function mvf_unit_suggester_locale_unit in Measured Value Field 7
Suggest output unit for a MVF field.
Parameters
array $items: Array of MVF field items for which you are requested to suggest output unit
array $field: Field API field definition array of MVF field
array $instance: Field API instance definition array of MVF field
object $entity: Fully loaded entity, for which you are requested to suggest output unit
string $entity_type: Entity type of $entity
array $settings: Array of currently stored settings in the provided $instance, you are encouraged to use it when deciding what output unit to suggest
array $plugin: cTools plugin definition array of your unit suggester plugin
Return value
int ID of a 'units_unit' entity, that you suggest as output unit. Two additional constants can be used as output here:
- MVF_UNIT_ORIGINAL: means to output $items as they are, in whatever units they were entered
- MVF_UNIT_UNKNOWN: means you cannot make any good suggestion for output unit
1 string reference to 'mvf_unit_suggester_locale_unit'
- locale.inc in plugins/
unit_suggesters/ locale.inc
File
- plugins/
unit_suggesters/ locale.inc, line 89
Code
function mvf_unit_suggester_locale_unit($items, $field, $instance, $entity, $entity_type, $settings = array(), $plugin) {
global $language;
return isset($settings[$language->language]) ? $settings[$language->language] : MVF_UNIT_UNKNOWN;
}