function batch_example_op_1 in Examples for Developers 7
Same name and namespace in other branches
- 8 batch_example/batch_example.module \batch_example_op_1()
- 6 batch_example/batch_example.module \batch_example_op_1()
- 3.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 - Outlines how a module can use the Batch API.
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();
}