You are here

function mvf_field in Measured Value Field 6

Implementation of hook_field().

File

./mvf.module, line 175
Measured Value Field module.

Code

function mvf_field($op, &$node, $field, &$items, $teaser, $page) {
  if ($op == 'validate') {
    if (is_array($items)) {
      foreach ($items as $delta => $item) {
        mvf_validate_field_value($field, $delta, $item);
      }
    }
  }
  if ($op == 'presave') {
    if (is_array($items)) {
      foreach ($items as $delta => $item) {

        // Empty "To" value should be saved equal to "From" value
        if ($item['value2'] == '') {
          $items[$delta]['value2'] = $items[$delta]['value'];
        }
      }
    }
  }
}