You are here

function gathercontent_views_vbo_update in GatherContent 7.3

Submit callback for `views_bulk_operations_confirm_form`.

This callback is used for `gathercontent_update` action and it is substitution for VBO in order to redirect to custom view after operation is completed.

@inheritdoc

1 string reference to 'gathercontent_views_vbo_update'
gathercontent_views_bulk_operations_form_alter in ./gathercontent.module
Implements hook_views_bulk_operations_form_alter().

File

./gathercontent.module, line 1192

Code

function gathercontent_views_vbo_update($form, &$form_state) {
  $uuid = _gathercontent_uuid_generate();
  $operation = entity_create('gathercontent_operation', array(
    'uuid' => $uuid,
    'type' => 'update',
  ));
  entity_save('gathercontent_operation', $operation);
  $operations = array();
  $nodes = node_load_multiple($form_state['selection']);
  foreach ($nodes as $node) {
    $operations[] = array(
      'gathercontent_update_process',
      array(
        $node,
        $uuid,
        $form_state['values']['node_update_method'],
      ),
    );
  }
  $batch = array(
    'title' => t('Updating content ...'),
    'operations' => $operations,
    'finished' => 'gathercontent_update_finished',
    'init_message' => t('Update is starting ...'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('An error occurred during processing'),
  );
  batch_set($batch);
}