function batch_example_op_1

Same name in other branches
  1. 3.x modules/batch_example/batch_example.module \batch_example_op_1()
  2. 4.0.x modules/batch_example/batch_example.module \batch_example_op_1()

Batch operation for batch 1: load a node.

This is the function that is called on each operation in batch 1.

Related topics

1 string reference to 'batch_example_op_1'
batch_example_batch_1 in batch_example/batch_example.module
Batch 1 definition: Load the node with the lowest nid 1000 times.

File

batch_example/batch_example.module, line 142

Code

function batch_example_op_1($nid, $operation_details, &$context) {
    $node = node_load($nid, NULL, TRUE);
    // Store some results for post-processing in the 'finished' callback.
    // The contents of 'results' will be available as $results in the
    // 'finished' function (in this example, batch_example_finished()).
    $context['results'][] = $node->nid . ' : ' . check_plain($node->title);
    // Optional message displayed under the progressbar.
    $context['message'] = t('Loading node "@title"', array(
        '@title' => $node->title,
    )) . ' ' . $operation_details;
    _batch_example_update_http_requests();
}