function feeds_import_tab_form in Feeds 7.2
Same name and namespace in other branches
- 8.2 feeds.pages.inc \feeds_import_tab_form()
- 6 feeds.pages.inc \feeds_import_tab_form()
- 7 feeds.pages.inc \feeds_import_tab_form()
Render a feeds import form on node/id/import pages.
1 string reference to 'feeds_import_tab_form'
- feeds_menu in ./
feeds.module - Implements hook_menu().
File
- ./
feeds.pages.inc, line 177 - Menu callbacks, form callbacks and helpers.
Code
function feeds_import_tab_form($form, &$form_state, $node) {
$importer_id = feeds_get_importer_id($node->type);
$source = feeds_source($importer_id, $node->nid);
$form = array();
$form['#feed_nid'] = $node->nid;
$form['#importer_id'] = $importer_id;
$form['#redirect'] = 'node/' . $node->nid;
$form['source_status'] = array(
'#type' => 'fieldset',
'#title' => t('Status'),
'#tree' => TRUE,
'#value' => feeds_source_status($source),
);
$form = confirm_form($form, t('Import all content from source?'), 'node/' . $node->nid, '', t('Import'), t('Cancel'), 'confirm feeds update');
// Change submit button label if processing in background.
if ($source->importer->config['process_in_background']) {
$form['actions']['submit']['#value'] = t('Schedule import');
}
// Disable submit button if import is initiated.
$progress = $source
->progressImporting();
if ($progress !== FEEDS_BATCH_COMPLETE) {
$form['actions']['submit']['#disabled'] = TRUE;
$form['actions']['submit']['#value'] = t('Importing (@progress %)', array(
'@progress' => number_format(100 * $progress, 0),
));
// Check if import task is queued.
if ($source
->isQueued()) {
$form['source_status']['#value'] .= t('Run cron to continue the import.');
}
}
return $form;
}