You are here

public function FeedsImporter::setPlugin in Feeds 7.2

Same name and namespace in other branches
  1. 6 includes/FeedsImporter.inc \FeedsImporter::setPlugin()
  2. 7 includes/FeedsImporter.inc \FeedsImporter::setPlugin()

Set plugin.

@todo Error handling, handle setting to the same plugin.

Parameters

string $plugin_key: The name of 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 166
FeedsImporter class and related.

Class

FeedsImporter
Class for a Feeds importer.

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,
      );
    }
  }
}