You are here

public function FeedsImporter::copy in Feeds 8.2

Copy a FeedsImporter configuration into this importer.

Parameters

FeedsImporter $importer: The feeds importer object to copy from.

Overrides FeedsConfigurable::copy

File

lib/Drupal/feeds/FeedsImporter.php, line 147
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.

Namespace

Drupal\feeds

Code

public function copy(FeedsConfigurable $configurable) {
  parent::copy($configurable);
  if ($configurable instanceof FeedsImporter) {

    // Instantiate new fetcher, parser and processor and initialize their
    // configurations.
    foreach ($this->plugin_types as $plugin_type) {
      $this
        ->setPlugin($configurable->config[$plugin_type]['plugin_key']);
      $this->{$plugin_type}
        ->setConfig($configurable->config[$plugin_type]['config']);
    }
  }
}