You are here

function cer_batch_update_existing_finished in Corresponding Entity References 7.3

Same name and namespace in other branches
  1. 7 cer.module \cer_batch_update_existing_finished()
  2. 7.2 cer.module \cer_batch_update_existing_finished()

Batch 'finished' callback.

1 string reference to 'cer_batch_update_existing_finished'
cer_bulk_update_form_submit in ./cer.admin.inc
The update form. Allows bulk updating of current entities.

File

./cer.module, line 247

Code

function cer_batch_update_existing_finished($success, $results, $operations) {
  if ($success) {
    $message = format_plural($results['count'], '1 entity processed.', '@count entities processed.');
    if (isset($results['errors'])) {
      $type = 'warning';
      foreach ($results['errors'] as $e) {
        drupal_set_message($e
          ->getMessage(), 'error');
      }
    }
    else {
      $type = 'status';
    }
    drupal_set_message($message, $type);
  }
  else {

    // An error occurred. $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments:' . print_r($error_operation[0], TRUE);
    drupal_set_message($message, 'error');
  }
}