You are here

function interval_field_validate in Interval Field 7

Implements hook_field_validate().

See also

interval_field_widget_error()

File

./interval.module, line 74
Defines an interval field @copyright Copyright(c) 2011 Rowlands Group @license GPL v2+ http://www.fsf.org/licensing/licenses/gpl.html @author Lee Rowlands leerowlands at rowlandsgroup dot com

Code

function interval_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if (!empty($item['interval'])) {
      if (!is_numeric($item['interval'])) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'interval_non_numeric',
          'message' => t('You must enter a numeric value.'),
        );
      }
    }
  }
}