public function FeedsImporter::setPlugin in Feeds 7
Same name and namespace in other branches
- 6 includes/FeedsImporter.inc \FeedsImporter::setPlugin()
- 7.2 includes/FeedsImporter.inc \FeedsImporter::setPlugin()
Set plugin.
@todo Error handling, handle setting to the same plugin.
Parameters
$plugin_key: A fetcher, parser or processor plugin.
1 call to FeedsImporter::setPlugin()
- FeedsImporter::copy in includes/
FeedsImporter.inc - Copy a FeedsImporter configuration into this importer.
File
- includes/
FeedsImporter.inc, line 155 - FeedsImporter class and related.
Class
- FeedsImporter
- A FeedsImporter object describes how an external source should be fetched, parsed and processed. Feeds can manage an arbitrary amount of importers.
Code
public function setPlugin($plugin_key) {
// $plugin_type can be either 'fetcher', 'parser' or 'processor'
if ($plugin_type = FeedsPlugin::typeOf($plugin_key)) {
if ($plugin = feeds_plugin($plugin_key, $this->id)) {
// Unset existing plugin, switch to new plugin.
unset($this->{$plugin_type});
$this->{$plugin_type} = $plugin;
// Set configuration information, blow away any previous information on
// this spot.
$this->config[$plugin_type] = array(
'plugin_key' => $plugin_key,
);
}
}
}