function views_bulk_operations_form_submit in Views Bulk Operations (VBO) 6.3
Same name and namespace in other branches
- 5 views_bulk_operations.module \views_bulk_operations_form_submit()
- 6 views_bulk_operations.module \views_bulk_operations_form_submit()
- 7.3 views_bulk_operations.module \views_bulk_operations_form_submit()
Submit handler for the selected operation.
See also
1 string reference to 'views_bulk_operations_form_submit'
- views_bulk_operations_form in ./
views_bulk_operations.module - Define multistep form for selecting and executing an operation.
File
- ./
views_bulk_operations.module, line 464 - Allows operations to be performed on items selected in a view.
Code
function views_bulk_operations_form_submit($form, &$form_state) {
$plugin = $form['#plugin'];
switch ($form_state['values']['step']) {
case VIEWS_BULK_OPS_STEP_VIEW:
$form_state['storage']['step'] = $form_state['values']['step'];
$form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW] = $form_state['values'];
_views_bulk_operations_adjust_selection($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['objects']['selection'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['objects']['select_all'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['exposed_input'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['arguments'], $plugin);
$operation = $plugin
->get_operation_info($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['operation']);
if (!$operation['configurable'] && $plugin->options['skip_confirmation']) {
break;
// Go directly to execution
}
return;
case VIEWS_BULK_OPS_STEP_SINGLE:
$form_state['storage']['step'] = $form_state['values']['step'];
$form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW] = $form_state['values'];
$form_state['storage'][VIEWS_BULK_OPS_STEP_CONFIG] = $form_state['values'];
// we're not taking any chances
_views_bulk_operations_adjust_selection($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['objects']['selection'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['objects']['select_all'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['exposed_input'], $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['arguments'], $plugin);
$operation = $plugin
->get_operation_info($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['operation']);
if ($operation['configurable']) {
$form_state['storage']['operation_arguments'] = _views_bulk_operations_action_submit($operation, $form, $form_state);
}
if ($plugin->options['skip_confirmation']) {
break;
// Go directly to execution
}
return;
case VIEWS_BULK_OPS_STEP_CONFIG:
$form_state['storage']['step'] = $form_state['values']['step'];
$form_state['storage'][VIEWS_BULK_OPS_STEP_CONFIG] = $form_state['values'];
$operation = $plugin
->get_operation_info($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['operation']);
$form_state['storage']['operation_arguments'] = _views_bulk_operations_action_submit($operation, $form, $form_state);
if ($plugin->options['skip_confirmation']) {
break;
// Go directly to execution
}
return;
case VIEWS_BULK_OPS_STEP_CONFIRM:
break;
}
// Clean up unneeded SESSION variables.
unset($_SESSION['vbo_values'][$_GET['q']]);
// Execute the VBO.
$operation = $plugin
->get_operation_info($form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['operation']);
$operation_arguments = array();
if ($operation['configurable']) {
$form_state['values'] += $form_state['storage'][VIEWS_BULK_OPS_STEP_CONFIG];
$operation_arguments = $form_state['storage']['operation_arguments'];
}
_views_bulk_operations_execute($plugin->view, $form_state['storage'][VIEWS_BULK_OPS_STEP_VIEW]['objects']['selection'], $operation, $operation_arguments, array(
'execution_type' => $plugin->options['execution_type'],
'display_result' => $plugin->options['display_result'],
'settings' => $plugin
->get_operation_settings($operation),
));
// Clean up the form.
unset($form_state['storage']);
$form_state['redirect'] = isset($form_state['values']['exposed_input']['destination']) ? $form_state['values']['exposed_input']['destination'] : $_GET['q'];
}