You are here

function cacheflush_ui_multiple_delete_confirm in CacheFlush 7.3

Multiple delete confirmation form for CacheflushUIController::overviewForm.

1 call to cacheflush_ui_multiple_delete_confirm()
CacheflushUIController::overviewForm in modules/cacheflush_ui/includes/cacheflush_ui.class.inc
Overrides EntityDefaultUIController::overviewForm().

File

modules/cacheflush_ui/includes/cacheflush_ui.class.inc, line 417
Contains the CacheflushUIController class.

Code

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

  // array_filter returns only elements with TRUE values.
  foreach ($presets as $id => $value) {
    $title = db_query('SELECT title FROM {cacheflush} WHERE id = :id', array(
      ':id' => $id,
    ))
      ->fetchField();
    $form['presets'][$id] = array(
      '#type' => 'hidden',
      '#value' => $id,
      '#prefix' => '<li>',
      '#suffix' => check_plain($title) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  $form['#submit'][] = 'cacheflush_ui_multiple_delete_confirm_submit';
  $confirm_question = format_plural(count($presets), 'Are you sure you want to delete this item?', 'Are you sure you want to delete these items?');
  return confirm_form($form, $confirm_question, cacheflush_ui_get_path(), t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}