You are here

function panopoly_widgets_field_validate in Panopoly Widgets 7

Implements hook_field_validate().

File

./panopoly_widgets.spotlight.inc, line 349
A specification for the custom spotlight entity that is part of Panopoly Widgets

Code

function panopoly_widgets_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if (!panopoly_widgets_field_is_empty($item, $field) && empty($item['fid'])) {
      $errors[$field['field_name']][$langcode][$delta][] = array(
        'error' => 'panopoly_widgets_spotlight_image_required',
        'message' => t('!name field is required.', array(
          '!name' => t('Image'),
        )),
      );
    }
  }
}