public static function FeedImport::setProcessorSettings in Feed Import 8
Sets processor settings.
Parameters
FeedImportProcessor $fi: The processor
object $feed: Feed settings
string $filter_dir: Path to extra filters dir
Return value
FeedImportProcessor An instance of FeedImportProcessor or FALSE on error
1 call to FeedImport::setProcessorSettings()
- FeedImport::import in feed_import_base/
src/ FeedImport.php - Imports a feed.
File
- feed_import_base/
src/ FeedImport.php, line 132
Class
- FeedImport
- This class provides helper functions for feed import.
Namespace
Drupal\feed_import_baseCode
public static function setProcessorSettings(FeedImportProcessor $fi, $feed, $filter_dir) {
$s = $feed->settings;
$ok = TRUE;
$ok = $ok && $fi
->setEntityInfo(static::getEntityInfo($feed->entity));
$ok = $ok && $fi
->setOptions($s['processor']['options']);
if (!isset($s['functions'])) {
$s['functions'] = NULL;
}
$ok = $ok && $fi
->setFilter(new $s['filter']['class']($filter_dir, $s['filter']['options']), $s['functions']);
$ok = $ok && $fi
->setReader(new $s['reader']['class']($s['reader']['options']));
$hm = new $s['hashes']['class']($feed->entity, $feed->machine_name);
$hm
->setOptions($s['hashes']['options']);
$ok = $ok && $fi
->setHashManager($hm);
$ok = $ok && $fi
->setUniq($s['uniq_path']);
$ok = $ok && $fi
->setFields($s['fields'], $s['static_fields'], static::getFieldsCompareFunctions(), static::getMergeFieldClasses(), static::$defaultFieldCompareFunction);
$ok = $ok && $fi
->setCustomSettings(array_diff_key($s, array(
'uniq_path' => 1,
'processor' => 1,
'reader' => 1,
'hashes' => 1,
'filter' => 1,
'fields' => 1,
'static_fields' => 1,
'feed' => 1,
'functions' => 1,
)));
return $ok ? TRUE : $fi
->getErrors();
}