You are here

function ad_multiple_delete_confirm in Advertisement 6

Same name and namespace in other branches
  1. 5.2 ad.module \ad_multiple_delete_confirm()
  2. 5 ad.module \ad_multiple_delete_confirm()
  3. 6.3 ad.admin.inc \ad_multiple_delete_confirm()
  4. 6.2 ad.admin.inc \ad_multiple_delete_confirm()
  5. 7 ad.admin.inc \ad_multiple_delete_confirm()

Display a form to confirm whether to really delete the selected ads.

1 string reference to 'ad_multiple_delete_confirm'
ad_admin_list in ./ad.admin.inc
Build default ad administration page.

File

./ad.admin.inc, line 144
Advertisement admin pages and functions.

Code

function ad_multiple_delete_confirm($form_state) {
  $form['ads'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach (array_filter($form_state['post']['ads']) as $aid => $value) {
    $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $aid));
    $form['ads'][$aid] = array(
      '#type' => 'hidden',
      '#value' => $aid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  return confirm_form($form, t('Are you sure you want to delete these ads?'), 'admin/content/ad', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
}