You are here

function cck_time_field in CCK Time 6

Implementation of hook_field().

File

./cck_time.module, line 63

Code

function cck_time_field($op, &$node, $field, &$items, $teaser, $page) {
  switch ($op) {
    case 'presave':
      if (empty($items)) {
        return;
      }
      if ($items[0]['hour'] === '' || $items[0]['minute'] === '') {
        return;
      }

      //intentional lack of support for multiple values
      $items[0]['value'] = $items[0]['hour'] . ':' . $items[0]['minute'];
      if (isset($items[0]['meridiem'])) {
        $items[0]['value'] .= $items[0]['meridiem'];
      }
      break;
  }
}