Skip to content
Snippets Groups Projects
Commit 18392cb3 authored by Alex Barth's avatar Alex Barth
Browse files

Move plugins form into feeds class.

parent 63b6227c
No related branches found
No related tags found
No related merge requests found
......@@ -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'),
......
......@@ -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.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment