diff --git a/includes/FeedsConfigurable.inc b/includes/FeedsConfigurable.inc index 0f3b013c65a3874ee98482a8e803ed0493c690a1..053001359e03966f7b3e76ce45ba7baf66e6a1fd 100644 --- a/includes/FeedsConfigurable.inc +++ b/includes/FeedsConfigurable.inc @@ -136,7 +136,7 @@ abstract class FeedsConfigurable { } /** - * Override magic method __get(). Make sure that $this->config goes through + * Override magic method __get(). Make sure that $this->config goes through * getConfig(). */ public function __get($name) { @@ -265,6 +265,8 @@ function feeds_form_submit($form, &$form_state) { /** * Helper for Feeds validate and submit callbacks. + * + * @todo This is all terrible. Remove. */ function _feeds_form_helper($form, &$form_state, $action) { $method = $form['#feeds_form_method'] . $action; @@ -277,12 +279,13 @@ function _feeds_form_helper($form, &$form_state, $action) { // This will re-initialize all of the plugins anyway, causing some tricky // saving issues in certain cases. // See http://drupal.org/node/1672880. - if ($class == variable_get('feeds_importer_class', 'FeedsImporter')) { $form['#configurable'] = feeds_importer($id); } else { - $form['#configurable'] = feeds_plugin($class, $id); + $importer = feeds_importer($id); + $plugin_key = $importer->config[$form['#configurable']->pluginType()]['plugin_key']; + $form['#configurable'] = feeds_plugin($plugin_key, $id); } if (method_exists($form['#configurable'], $method)) { diff --git a/plugins/FeedsFetcher.inc b/plugins/FeedsFetcher.inc index 4bba44d041adce420abeb13af763cd59d2fbe8aa..faca86391c9970773e39fd4ea236b372f6be0b97 100644 --- a/plugins/FeedsFetcher.inc +++ b/plugins/FeedsFetcher.inc @@ -113,6 +113,13 @@ class FeedsFetcherResult extends FeedsResult { */ abstract class FeedsFetcher extends FeedsPlugin { + /** + * Implements FeedsPlugin::pluginType(). + */ + public static function pluginType() { + return 'fetcher'; + } + /** * Fetch content from a source and return it. * diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index c49231700cd30fecadaa95672e17a5a5b2497e77..d63ea4326cda5f1ed81867539fcf24fd9e071a08 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -53,6 +53,13 @@ class FeedsParserResult extends FeedsResult { */ abstract class FeedsParser extends FeedsPlugin { + /** + * Implements FeedsPlugin::pluginType(). + */ + public static function pluginType() { + return 'parser'; + } + /** * Parse content fetched by fetcher. * diff --git a/plugins/FeedsPlugin.inc b/plugins/FeedsPlugin.inc index be833930960023cacd520b95f5b6000fd0ccc29f..97953ff2e383a8631c4bd9856bce115540a4a84e 100644 --- a/plugins/FeedsPlugin.inc +++ b/plugins/FeedsPlugin.inc @@ -29,6 +29,14 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter $this->source_config = $this->sourceDefaults(); } + /** + * Returns the type of plugin. + * + * @return string + * One of either 'fetcher', 'parser', or 'processor'. + */ + abstract public static function pluginType(); + /** * Save changes to the configuration of this object. * Delegate saving to parent (= Feed) which will collect diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index bc503ca728e564cd2cbd6dece3920ea038d5f31b..33397f73f215c4226e817bc618f0d047e2877d63 100755 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -28,6 +28,14 @@ class FeedsAccessException extends Exception {} * Abstract class, defines interface for processors. */ abstract class FeedsProcessor extends FeedsPlugin { + + /** + * Implements FeedsPlugin::pluginType(). + */ + public static function pluginType() { + return 'processor'; + } + /** * @defgroup entity_api_wrapper Entity API wrapper. */