You are here

function gc_views_vbo_upload in GatherContent 8

@TODO: function comment!!!

1 string reference to 'gc_views_vbo_upload'
gc_views_bulk_operations_form_alter in ./_old.gc.module
Implements hook_views_bulk_operations_form_alter().

File

./_old.gc.module, line 525

Code

function gc_views_vbo_upload($form, &$form_state) {
  $uuid = _gc_uuid_generate();
  $operation = \Drupal::entityManager()
    ->getStorage('gc_operation')
    ->create(array(
    'uuid' => $uuid,
    'type' => 'upload',
  ));
  $operation
    ->save();
  $operations = array();
  $nodes = \Drupal::entityManager()
    ->getStorage('node')
    ->loadMultiple($form_state['selection']);
  foreach ($nodes as $node) {
    $operations[] = array(
      'gc_upload_process',
      array(
        $node,
        $uuid,
      ),
    );
  }
  $batch = array(
    'title' => t('Uploading content ...'),
    'operations' => $operations,
    'finished' => 'gc_upload_finished',
    'init_message' => t('Upload is starting ...'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('An error occurred during processing'),
  );
  batch_set($batch);
}