You are here

function bat_event_field_validate in Booking and Availability Management Tools for Drupal 7

Implements hook_field_validate().

File

modules/bat_event/bat_event.module, line 1759
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

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

  // Extract unit ids to check.
  $ids = array();

  // Check for non-numeric values.
  foreach ($items as $delta => $item) {
    if (is_array($item) && !empty($item['state_id'])) {
      if (is_numeric($item['state_id'])) {
        $ids[] = $item['state_id'];
      }
      else {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'invalid_state_id',
          'message' => t('%name: invalid input.', array(
            '%name' => $instance['label'],
          )),
        );
      }
    }
  }
}