function makemeeting_field_validate in Make Meeting Scheduler 7.2
Implements hook_field_validate().
File
- ./
makemeeting.field.inc, line 352 - This file is mostly about the field configuration.
Code
function makemeeting_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
foreach ($items as $delta => $item) {
if (isset($item['choices'])) {
// Verify that we do not have duplicate dates
$dates = array();
foreach ($item['choices'] as $chid => $chvalue) {
$date = implode('', $chvalue['chdate']);
if (in_array($date, $dates)) {
// Register an error with the choice id
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'duplicate_dates',
'message' => t('%name: you can\'t have duplicate dates.', array(
'%name' => $instance['label'],
)),
'chid' => $chid,
);
}
else {
$dates[] = $date;
}
}
}
}
}