You are here

function delete_all_content_confirm in Delete all 6

Same name and namespace in other branches
  1. 7 delete_all.module \delete_all_content_confirm()
1 string reference to 'delete_all_content_confirm'
delete_all_menu in ./delete_all.module

File

./delete_all.module, line 149

Code

function delete_all_content_confirm() {
  $results = $_POST;
  $form = array();
  $form['method'] = array(
    '#type' => 'hidden',
    '#value' => $results['method'],
  );
  $form['all'] = array(
    '#type' => 'hidden',
    '#value' => $results['all'],
  );
  if ($results['all']) {
    $form['all_warning'] = array(
      '#prefix' => '<p>',
      '#suffix' => '<p>',
      '#value' => t('All content in all content types will be deleted. Be sure to have a backup of any important data!'),
    );
  }
  if (is_array($results['types'])) {
    foreach ($results['types'] as $key_type => $type) {
      $form['type_' . $key_type] = array(
        '#type' => 'hidden',
        '#value' => $type,
      );
      $info = node_get_types('type', $type);
      $form[$type . '_warning'] = array(
        '#prefix' => '<p>',
        '#suffix' => '<p>',
        '#value' => t('All content in the %type content type will be deleted. Be sure to have a backup of any important data!', array(
          '%type' => $info->name,
        )),
      );
    }
  }
  $keys = array_filter(array_keys($results), "_delete_all_type_keys");
  foreach ($keys as $key) {
    $form[$key] = array(
      '#type' => 'hidden',
      '#value' => $results[$key],
    );
  }
  return confirm_form($form, t('Are you sure you wish to delete content?'), 'admin/content/delete_content', NULL, t('Delete all content now'), t('Cancel delete of all content'));
}