diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc index bc52632cd1849f66144dd965006ea95ebe04228c..9e5287f004deacc8cedd1cb66f9b05ad6c84d55e 100644 --- a/feeds_ui/feeds_ui.admin.inc +++ b/feeds_ui/feeds_ui.admin.inc @@ -170,40 +170,11 @@ function feeds_ui_build_mapping_form(&$form_state, $feed) { */ function feeds_ui_build_plugin_form(&$form_state, $feed) { $form = array(); - $plugins = feeds_get_plugins(); $form['plugins'] = array( '#type' => 'fieldset', '#title' => t('Plugins'), ); - $form['plugins']['fetcher'] = array( - '#type' => 'radios', - '#title' => t('Fetcher'), - '#options' => $plugins['fetcher'], - '#description' => t('Select a fetcher for this configuration.'), - '#default_value' => empty($feed) ? key($plugins['fetcher']) : get_class($feed->fetcher), - ); - $form['plugins']['parser'] = array( - '#type' => 'radios', - '#title' => t('Parser'), - '#options' => $plugins['parser'], - '#description' => t('Select a parser for this configuration.'), - '#default_value' => empty($feed) ? key($plugins['parser']) : get_class($feed->parser), - ); - if (empty($feed)) { - $default = array(key($plugins['processor'])); - } - else { - foreach ($feed->processors as $processor) { - $default[get_class($processor)] = get_class($processor); - } - } - $form['plugins']['processors'] = array( - '#type' => 'checkboxes', - '#title' => t('Processors'), - '#options' => $plugins['processor'], - '#description' => t('Select processors for this configuration.'), - '#default_value' => $default, - ); + $form['plugins'] += $feed->pluginsForm($form_state); $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/includes/feed.inc b/includes/feed.inc index b2a32da00a69a5cfd32049cbd7e6a85b4e2995b5..1c10e8651db65a562936a57dc6d157e47723283d 100644 --- a/includes/feed.inc +++ b/includes/feed.inc @@ -80,6 +80,36 @@ class Feed extends FeedsConfigurable { return $form; } + /** + * Feed class specific plugin form. + */ + public function pluginsForm(&$form_state) { + $form = array(); + $plugins = feeds_get_plugins(); + $form['fetcher'] = array( + '#type' => 'radios', + '#title' => t('Fetcher'), + '#options' => $plugins['fetcher'], + '#description' => t('Select a fetcher for this configuration.'), + '#default_value' => $this->config['fetcher'], + ); + $form['parser'] = array( + '#type' => 'radios', + '#title' => t('Parser'), + '#options' => $plugins['parser'], + '#description' => t('Select a parser for this configuration.'), + '#default_value' => $this->config['parser'], + ); + $form['processors'] = array( + '#type' => 'checkboxes', + '#title' => t('Processors'), + '#options' => $plugins['processor'], + '#description' => t('Select processors for this configuration.'), + '#default_value' => $this->config['processors'], + ); + return $form; + } + /** * Import feed by using configured fetchers, parsers, processors. */