You are here

function date_field in Date 6

Same name and namespace in other branches
  1. 5.2 date/date.module \date_field()
  2. 5 date.module \date_field()
  3. 6.2 date/date.module \date_field()

Implementation of hook_field().

Validation and submission operation code is moved into a separate file and included only when processing forms.

File

date/date.module, line 343
Defines date/time field types for the Content Construction Kit (CCK).

Code

function date_field($op, &$node, $field, &$items, $teaser, $page) {
  switch ($op) {
    case 'validate':
      include_once drupal_get_path('module', 'date') . '/date_elements.inc';
      return _date_field_validate($op, $node, $field, $items, $teaser, $page);
      break;
    case 'insert':
    case 'update':
      include_once drupal_get_path('module', 'date') . '/date_elements.inc';
      return _date_field_update($op, $node, $field, $items, $teaser, $page);
      break;
    case 'sanitize':
      foreach ($items as $delta => $item) {

        //$dates = date_formatter_process($field, $item, $node, $formatter);

        //$node->$field['field_name'][$delta]['dates'] = $dates;
      }
      break;
  }
}