function gc_views_bulk_operations_form_alter in GatherContent 8
Implements hook_views_bulk_operations_form_alter().
Alter VBO confirm form for gc_update action and replace submit callback, so we can use custom batch.
File
- ./
_old.gc.module, line 391
Code
function gc_views_bulk_operations_form_alter(&$form, &$form_state, $vbo) {
if ($form_state['step'] === 'views_bulk_operations_confirm_form') {
switch ($form_state['values']['operation']) {
case 'action::gc_update':
$array = array(
implode('+', array_filter($form_state['values']['views_bulk_operations'])),
);
$view = views_get_view('update');
$view
->set_display("block_1");
$view
->set_arguments($array);
$view
->preview();
$content = $view
->render();
$form['description']['#markup'] = '<p>' . t('Please review your selection before updating.') . '</p>' . $content;
$form['#vbo_confirm_form_title'] = \Drupal::translation()
->formatPlural(count(array_filter($form_state['values']['views_bulk_operations'])), 'Confirm update selection (@count item)', 'Confirm update selection (@count items)');
$form['actions']['submit']['#submit'] = array(
'gc_views_vbo_update',
);
break;
case 'action::gc_upload':
$array = array(
implode('+', array_filter($form_state['values']['views_bulk_operations'])),
);
$view = views_get_view('update');
$view
->set_display("block_1");
$view
->set_arguments($array);
$view
->preview();
$content = $view
->render();
$form['description']['#markup'] = '<p>' . t('Please review your selection before upload.') . '</p>' . $content;
$form['#vbo_confirm_form_title'] = \Drupal::translation()
->formatPlural(count(array_filter($form_state['values']['views_bulk_operations'])), 'Confirm upload selection (@count item)', 'Confirm upload selection (@count items)');
$form['actions']['submit']['#submit'] = array(
'gc_views_vbo_upload',
);
break;
}
}
}