function gc_upload_finished in GatherContent 8
Finished callback.
@inheritdoc
1 string reference to 'gc_upload_finished'
- gc_views_vbo_upload in ./
_old.gc.module - @TODO: function comment!!!
File
- ./
_old.gc.module, line 750
Code
function gc_upload_finished($success, $results, $operations) {
if ($success) {
// Select all items with uuid.
$query = new EntityFieldQuery();
$result = $query
->entityCondition('entity_type', 'gc_operation_item')
->propertyCondition('operation_uuid', $results['uuid'])
->execute();
if (isset($result['gc_operation_item'])) {
$operation_items = \Drupal::entityManager()
->getStorage('gc_operation_item');
$success_counter = 0;
foreach ($operation_items as $operation_item) {
if ($operation_item->status === 'Success') {
$success_counter++;
}
}
$unsuccessful = count($result['gc_operation_item']) - $success_counter;
drupal_set_message(\Drupal::translation()
->formatPlural($success_counter, '1 item was uploaded successfully.', '@count items were uploaded successfully.'));
if ($unsuccessful > 0) {
drupal_set_message(\Drupal::translation()
->formatPlural($unsuccessful, '1 item was not uploaded. Check errors below.', '@count items were not uploaded. Check errors below.'), 'error');
}
}
drupal_goto('admin/content/upload/result/' . $results['uuid']);
}
else {
$error_operation = reset($operations);
drupal_set_message(t('An error occurred while processing @operation with arguments : @args', array(
'@operation' => $error_operation[0],
'@args' => print_r($error_operation[0], TRUE),
)), 'error');
}
}