You are here

function feeds_delete_tab_form in Feeds 8.2

Same name and namespace in other branches
  1. 6 feeds.pages.inc \feeds_delete_tab_form()
  2. 7.2 feeds.pages.inc \feeds_delete_tab_form()
  3. 7 feeds.pages.inc \feeds_delete_tab_form()

Render a feeds delete form.

Used on both node pages and configuration pages. Therefore $node may be missing.

1 string reference to 'feeds_delete_tab_form'
feeds_menu in ./feeds.module
Implements hook_menu().

File

./feeds.pages.inc, line 159
Menu callbacks, form callbacks and helpers.

Code

function feeds_delete_tab_form($form, &$form_state, $importer_id, $node = NULL) {
  if (empty($node)) {
    $source = feeds_source($importer_id);
    $form['#redirect'] = 'import/' . $source->id;
  }
  else {
    $importer_id = feeds_get_importer_id($node->type);
    $source = feeds_source($importer_id, $node->nid);
    $form['#redirect'] = 'node/' . $source->feed_nid;
  }

  // Form cannot pass on source object.
  $form['#importer_id'] = $source->id;
  $form['#feed_nid'] = $source->feed_nid;
  $form['source_status'] = array(
    '#type' => 'fieldset',
    '#title' => t('Status'),
    '#tree' => TRUE,
    '#value' => feeds_source_status($source),
  );
  $form = confirm_form($form, t('Delete all items from source?'), $form['#redirect'], '', t('Delete'), t('Cancel'), 'confirm feeds update');
  $progress = $source
    ->progressClearing();
  if ($progress !== FEEDS_BATCH_COMPLETE) {
    $form['actions']['submit']['#disabled'] = TRUE;
    $form['actions']['submit']['#value'] = t('Deleting (@progress %)', array(
      '@progress' => number_format(100 * $progress, 0),
    ));
  }
  return $form;
}