You are here

function mvf_subfield_to_column in Measured Value Field 7

Supportive function.

Convert values between sub field names and columns they represent.

Parameters

string $value: Either column name or sub field name

string $target: Expected converted value. Allowed values are: column - $value should hold sub field name and returned will be column name of the supplied sub field subfield - $value should hold column name and returned will be sub field name of the supplied column

Return value

string See description of $target parameter for details on returned value

5 calls to mvf_subfield_to_column()
mvf_data_property_info in ./mvf.module
Defines info for the properties of the MVF field data structure.
mvf_field_views_data in views/mvf.views.inc
Implements hook_field_views_data().
mvf_handler_filter_mvf::op_between in views/mvf_handler_filter_mvf.inc
mvf_handler_filter_mvf::op_simple in views/mvf_handler_filter_mvf.inc
_mvf_widget_process in ./mvf.module
Process function for form element type 'mvf_widget'.

File

./mvf.module, line 1446
Define a field type of measured value.

Code

function mvf_subfield_to_column($value, $target = 'column') {
  $map = array(
    'value' => 'value',
    'unit' => 'target_id',
  );
  if ($target == 'subfield') {
    $map = array_flip($map);
  }
  return $map[$value];
}