You are here

function field_timer_field_presave in Field Timer 7

Same name and namespace in other branches
  1. 7.2 field_timer.module \field_timer_field_presave()

Implements hook_field_presave().

File

./field_timer.module, line 235
Main module file.

Code

function field_timer_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {

  // Date popup widget return date as formatted string. We need to convert it to
  // timestamp.
  if ($field['type'] == 'field_timer') {
    foreach ($items as $delta => $item) {
      if (!empty($item['timestamp'])) {
        $timestamp = strtotime($item['timestamp']);
        if ($timestamp) {
          $items[$delta]['timestamp'] = $timestamp;
        }
      }
    }
  }
}