function commerce_reset_generate_batch_operations in Commerce Reset 7
Generate batch operations.
Parameters
string $callback: The function to execute.
object $data: The data to that will be added to the batch.
int $count: Total number of records.
array $operations: Batch operation.
Return value
array Batch array.
1 call to commerce_reset_generate_batch_operations()
- commerce_reset_generate_batch_items in ./
commerce_reset.module - Batch generate items.
File
- ./
commerce_reset.module, line 143
Code
function commerce_reset_generate_batch_operations($callback, $data, $count, array $operations, $primary_key) {
$i = 1;
if (is_array($data)) {
foreach ($data as $datum) {
$params = array(
'id' => $datum->{$primary_key},
'current' => $i++,
'total' => $count,
);
$operations[] = array(
$callback,
array(
$params,
),
);
}
}
else {
$operations[] = array(
$callback,
array(),
);
}
return $operations;
}