You are here

function mvf_unit_suggester_hardcoded_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_hardcoded_unit'
hardcoded.inc in plugins/unit_suggesters/hardcoded.inc

File

plugins/unit_suggesters/hardcoded.inc, line 86

Code

function mvf_unit_suggester_hardcoded_unit($items, $field, $instance, $entity, $entity_type, $settings = array(), $plugin) {
  return isset($settings['unit']) ? $settings['unit'] : MVF_UNIT_UNKNOWN;
}