You are here

public function FeedsProcessor::validateConfig in Feeds 7.2

Validates the configuration.

Return value

array A list of errors.

Overrides FeedsConfigurable::validateConfig

File

plugins/FeedsProcessor.inc, line 1005
Contains FeedsProcessor and related classes.

Class

FeedsProcessor
Abstract class, defines interface for processors.

Code

public function validateConfig() {
  $errors = parent::validateConfig();
  $info = $this
    ->entityInfo();
  $config = $this
    ->getConfig();

  // Check configured bundle if the bundle is configurable.
  if (isset($config['bundle']) && !empty($info['entity keys']['bundle'])) {
    $bundles = $this
      ->bundleOptions();
    if (!in_array($config['bundle'], array_keys($bundles))) {
      $errors[] = t('Invalid value %value for config option %key.', array(
        '%value' => $config['bundle'],
        '%key' => !empty($info['bundle name']) ? $info['bundle name'] : t('Bundle'),
      ));
    }
  }

  // Check configured language.
  if (module_exists('locale') && !empty($info['entity keys']['language']) && isset($config['language'])) {
    $languages = $this
      ->languageOptions();
    if (!isset($languages[$config['language']])) {
      $errors[] = t('Invalid value %value for config option %key.', array(
        '%value' => $config['language'],
        '%key' => t('Language'),
      ));
    }
  }
  return $errors;
}