You are here

function feeds_import_tab_form in Feeds 8.2

Same name and namespace in other branches
  1. 6 feeds.pages.inc \feeds_import_tab_form()
  2. 7.2 feeds.pages.inc \feeds_import_tab_form()
  3. 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 121
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');
  $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),
    ));
  }
  return $form;
}