function _batch_test_finished_helper

Same name in other branches
  1. 9 core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_finished_helper()
  2. 8.9.x core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_finished_helper()
  3. 10 core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_finished_helper()
  4. 11.x core/modules/system/tests/modules/batch_test/batch_test.callbacks.inc \_batch_test_finished_helper()

Implements callback_batch_finished().

Common 'finished' callbacks for batches 1 to 4.

6 calls to _batch_test_finished_helper()
_batch_test_finished_0 in modules/simpletest/tests/batch_test.callbacks.inc
Implements callback_batch_finished().
_batch_test_finished_1 in modules/simpletest/tests/batch_test.callbacks.inc
Implements callback_batch_finished().
_batch_test_finished_2 in modules/simpletest/tests/batch_test.callbacks.inc
Implements callback_batch_finished().
_batch_test_finished_3 in modules/simpletest/tests/batch_test.callbacks.inc
Implements callback_batch_finished().
_batch_test_finished_4 in modules/simpletest/tests/batch_test.callbacks.inc
Implements callback_batch_finished().

... See full list

File

modules/simpletest/tests/batch_test.callbacks.inc, line 91

Code

function _batch_test_finished_helper($batch_id, $success, $results, $operations) {
    $messages = array(
        "results for batch {$batch_id}",
    );
    if ($results) {
        foreach ($results as $op => $op_results) {
            $messages[] = 'op ' . $op . ': processed ' . count($op_results) . ' elements';
        }
    }
    else {
        $messages[] = 'none';
    }
    if (!$success) {
        // A fatal error occurred during the processing.
        $error_operation = reset($operations);
        $messages[] = t('An error occurred while processing @op with arguments:<br/>@args', array(
            '@op' => $error_operation[0],
            '@args' => print_r($error_operation[1], TRUE),
        ));
    }
    drupal_set_message(implode('<br />', $messages));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.