You are here

public function FeedsEntityProcessor::configFormValidate in Feeds entity processor 7

Overrides parent::configFormValidate().

File

src/FeedsEntityProcessor.inc, line 231
Contains FeedsEntityProcessor.

Class

FeedsEntityProcessor
Creates entities from feed items.

Code

public function configFormValidate(&$values) {
  $form = parent::configFormValidate($values);
  foreach ($this
    ->entityProperties() as $name => $property) {
    if (!isset($property['type']) || !array_key_exists($name, $values['values'])) {
      continue;
    }

    // Validate the value.
    $plugin = feeds_entity_processor_plugin($name, $property, $this
      ->entityWrapper(), $this);
    $errors = $plugin
      ->validate($values['values'][$name]);
    if (count($errors) === 1) {
      $error = reset($errors);
      form_set_error("values][{$name}", $error);
    }
    elseif (count($errors) > 1) {
      $errors = theme('item_list', array(
        'items' => $errors,
      ));
      form_set_error("values][{$name}", t('The field %field has the following errors: !errors', array(
        '%field' => $property['label'],
        '!errors' => $errors,
      )));
    }
  }
}