From 18392cb35f8d0cb15c50c07748ef61ba4c4ee8db Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Wed, 16 Sep 2009 21:49:03 +0000 Subject: [PATCH] Move plugins form into feeds class. --- feeds_ui/feeds_ui.admin.inc | 31 +------------------------------ includes/feed.inc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/feeds_ui/feeds_ui.admin.inc b/feeds_ui/feeds_ui.admin.inc index bc52632c..9e5287f0 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 b2a32da0..1c10e865 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. */ -- GitLab