1 batch_example.module batch_example_finished($success, $results, $operations)

Batch 'finished' callback used by both batch 1 and batch 2.

Related topics

File

modules/examples/batch_example/batch_example.module, line 262
Hook implementations for the Batch Example module.

Code

function batch_example_finished($success, $results, $operations) {
  if ($success) {
    // Here we could do something meaningful with the results.
    // We just display the number of nodes we processed...
    backdrop_set_message(t('@count results processed in @requests HTTP requests.', array('@count' => count($results), '@requests' => _batch_example_get_http_requests())));
    backdrop_set_message(t('The final result was "%final"', array('%final' => end($results))));
  }
  else {
    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    backdrop_set_message(
    t('An error occurred while processing @operation with arguments : @args', 
    array(
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    )
    )
    );
  }
}