function feeds_ui_edit_page in Feeds 6
Same name and namespace in other branches
- 8.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_edit_page()
- 7.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_edit_page()
- 7 feeds_ui/feeds_ui.admin.inc \feeds_ui_edit_page()
Edit feed configuration.
1 string reference to 'feeds_ui_edit_page'
- feeds_ui_menu in feeds_ui/
feeds_ui.module - Implementation of hook_menu().
File
- feeds_ui/
feeds_ui.admin.inc, line 275 - Contains all page callbacks, forms and theming functions for Feeds administrative pages.
Code
function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
// Get plugins and configuration.
$plugins = feeds_get_plugins();
$config = $importer->config;
// Base path for changing the active container.
$path = 'admin/build/feeds/edit/' . $importer->id;
$active_container = array(
'class' => 'active-container',
'actions' => array(
l(t('Help'), $path),
),
);
switch ($active) {
case 'help':
$active_container['title'] = t('Getting started');
$active_container['body'] = '<div class="help feeds-admin-ui">' . feeds_ui_edit_help() . '</div>';
unset($active_container['actions']);
break;
case 'fetcher':
case 'parser':
case 'processor':
$active_container['title'] = t('Select a !plugin_type', array(
'!plugin_type' => $active,
));
$active_container['body'] = drupal_get_form('feeds_ui_plugin_form', $importer, $active);
break;
case 'settings':
drupal_add_js(drupal_get_path('module', 'ctools') . '/js/dependent.js');
ctools_include('dependent');
if (empty($plugin_key)) {
$active_container['title'] = t('Basic settings');
$active_container['body'] = feeds_get_form($importer, 'configForm');
}
elseif (in_array($plugin_key, array_keys($plugins)) && ($plugin = feeds_plugin_instance($plugin_key, $importer->id))) {
$active_container['title'] = t('Settings for !plugin', array(
'!plugin' => $plugins[$plugin_key]['name'],
));
$active_container['body'] = feeds_get_form($plugin, 'configForm');
}
break;
case 'mapping':
$active_container['title'] = t('Mapping for !processor', array(
'!processor' => $plugins[$config['processor']['plugin_key']]['name'],
));
$active_container['body'] = drupal_get_form('feeds_ui_mapping_form', $importer);
break;
}
// Build config info.
$config_info = $info = array();
$info['class'] = 'config-set';
// Basic information.
$items = array();
$items[] = t('Attached to: !type', array(
'!type' => $importer->config['content_type'] ? node_get_types('name', $importer->config['content_type']) : t('[none]'),
));
if ($importer->config['import_period'] == FEEDS_SCHEDULE_NEVER) {
$import_period = t('never');
}
elseif ($importer->config['import_period'] == 0) {
$import_period = t('as often as possible');
}
else {
$import_period = t('every !interval', array(
'!interval' => format_interval($importer->config['import_period']),
));
}
$items[] = t('Refresh: !import_period', array(
'!import_period' => $import_period,
));
$items[] = $importer->config['import_on_create'] ? t('Import on create') : t('Do not import on create');
$info['title'] = t('Basic settings');
$info['body'] = array(
array(
'body' => theme('item_list', $items),
'actions' => array(
l(t('Settings'), $path . '/settings'),
),
),
);
$config_info[] = $info;
// Fetcher.
$fetcher = $plugins[$config['fetcher']['plugin_key']];
$actions = array();
if (feeds_get_form($importer->fetcher, 'configForm')) {
$actions = array(
l(t('Settings'), $path . '/settings/' . $config['fetcher']['plugin_key']),
);
}
$info['title'] = t('Fetcher');
$info['body'] = array(
array(
'title' => $fetcher['name'],
'body' => $fetcher['description'],
'actions' => $actions,
),
);
$info['actions'] = array(
l(t('Change'), $path . '/fetcher'),
);
$config_info[] = $info;
// Parser.
$parser = $plugins[$config['parser']['plugin_key']];
$actions = array();
if (feeds_get_form($importer->parser, 'configForm')) {
$actions = array(
l(t('Settings'), $path . '/settings/' . $config['parser']['plugin_key']),
);
}
$info['title'] = t('Parser');
$info['body'] = array(
array(
'title' => $parser['name'],
'body' => $parser['description'],
'actions' => $actions,
),
);
$info['actions'] = array(
l(t('Change'), $path . '/parser'),
);
$config_info[] = $info;
// Processor.
$processor = $plugins[$config['processor']['plugin_key']];
$actions = array();
if (feeds_get_form($importer->processor, 'configForm')) {
$actions[] = l(t('Settings'), $path . '/settings/' . $config['processor']['plugin_key']);
}
$actions[] = l(t('Mapping'), $path . '/mapping');
$info['title'] = t('Processor');
$info['body'] = array(
array(
'title' => $processor['name'],
'body' => $processor['description'],
'actions' => $actions,
),
);
$info['actions'] = array(
l(t('Change'), $path . '/processor'),
);
$config_info[] = $info;
return theme('feeds_ui_edit_page', $config_info, $active_container);
}