You are here

function views_bulk_operations_confirm_form in Views Bulk Operations (VBO) 7.3

Multistep form callback for the "confirm" step.

2 string references to 'views_bulk_operations_confirm_form'
hook_views_bulk_operations_form_alter in ./views_bulk_operations.api.php
Perform alterations on the VBO form before it is rendered.
views_bulk_operations_form_submit in ./views_bulk_operations.module
Submit handler for all steps of the VBO multistep form.

File

./views_bulk_operations.module, line 631
Allows operations to be performed on items selected in a view.

Code

function views_bulk_operations_confirm_form($form, &$form_state, $view, $output) {
  $vbo = _views_bulk_operations_get_field($view);
  $operation = $form_state['operation'];
  $rows = $form_state['selection'];
  $query = drupal_get_query_parameters($_GET, array(
    'q',
  ));
  $title = t('Are you sure you want to perform %operation on the selected items?', array(
    '%operation' => $operation
      ->label(),
  ));
  $form = confirm_form($form, $title, array(
    'path' => $view
      ->get_url(),
    'query' => $query,
  ), theme('views_bulk_operations_confirmation', array(
    'rows' => $rows,
    'vbo' => $vbo,
    'operation' => $operation,
    'select_all_pages' => $form_state['select_all_pages'],
  )));

  // Add VBO's submit handler to the Confirm button added by config_form().
  $form['actions']['submit']['#submit'] = array(
    'views_bulk_operations_form_submit',
  );

  // We can't set the View title here as $view is just a copy of the original,
  // and our settings changes won't "stick" for the first page load of the
  // confirmation form. We also can't just call drupal_set_title() directly
  // because our title will be clobbered by the actual View title later. So
  // let's tuck the title away in the form for use later.
  // @see views_bulk_operations_preprocess_views_view()
  $form['#vbo_confirm_form_title'] = $title;
  return $form;
}