You are here

public function FeedsImporter::setPlugin in Feeds 6

Same name and namespace in other branches
  1. 7.2 includes/FeedsImporter.inc \FeedsImporter::setPlugin()
  2. 7 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 164
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 = feeds_plugin_type($plugin_key)) {
    if ($plugin = feeds_plugin_instance($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,
      );
    }
  }
}