1 redirect.admin.inc redirect_list_form_operations_confirm_form($form, &$form_state, $operation, $rids)

Form callback; Confirm a bulk operation on a list of redirects.

Parameters

string $operation: An operation string from hook_redirect_operations().

int[] $rids: An array of redirect IDs on which the operation will be performed.

See also

redirect_list_form()

File

core/modules/redirect/redirect.admin.inc, line 287
Administrative page callbacks for the Redirect module.

Code

function redirect_list_form_operations_confirm_form($form, &$form_state, $operation, $rids) {
  $operations = $form['#operations'];
  $operation = $operations[$form_state['values']['operation']];

  $form['rids_list'] = array(
    '#theme' => 'item_list',
    '#items' => array(),
  );
  $form['rids'] = array(
    '#type' => 'value',
    '#value' => $rids,
  );

  $redirects = redirect_load_multiple($rids);
  foreach ($redirects as $rid => $redirect) {
    $form['rids_list']['#items'][$rid] = check_plain(redirect_url($redirect->source, $redirect->source_options));
  }

  $form['operation'] = array('#type' => 'hidden', '#value' => $form_state['values']['operation']);
  $form['#submit'][] = 'redirect_list_form_operations_submit';
  $confirm_question = format_plural(count($rids), 'Are you sure you want to @action this redirect?', 'Are you sure you want to @action these redirects?', array('@action' => backdrop_strtolower($operation['action'])));

  // Cancel link returns to the current search if possible.
  $cancel_path = strpos($_GET['q'], 'admin/config/urls/redirect') === 0 ? $_GET['q'] : 'admin/config/urls/redirect';

  return confirm_form(
  $form, 
  $confirm_question, 
  $cancel_path, 
  t('This action cannot be undone.'), 
  $operation['action'], 
  t('Cancel')
  );
}