public static function ProcessForm::batchOperation in Module Builder 8.3
Implements callback_batch_operation().
1 call to ProcessForm::batchOperation()
- ProcessFormExtra::batchOperation in module_builder_devel/
src/ Form/ ProcessFormExtra.php - Implements callback_batch_operation().
1 method overrides ProcessForm::batchOperation()
- ProcessFormExtra::batchOperation in module_builder_devel/
src/ Form/ ProcessFormExtra.php - Implements callback_batch_operation().
File
- src/
Form/ ProcessForm.php, line 204
Class
- ProcessForm
- Form for running the DCB analysis process.
Namespace
Drupal\module_builder\FormCode
public static function batchOperation($job_batch, &$context) {
$task_handler_collect = static::getCollectTask();
try {
$task_handler_collect
->collectComponentDataIncremental($job_batch, $context['results']);
} catch (\Exception $e) {
// Store an exception message and bail on this operation.
$context['results']['errors'][] = $e
->getMessage();
return;
}
// Assemble a progress message.
$labels = [];
$message_pieces = [];
foreach ($job_batch as $job) {
if (isset($job['item_label'])) {
// One job among several for a collector.
$labels[$job['process_label']][] = $job['item_label'];
}
else {
// Singleton job.
// Put it in the labels array to preserve the order.
$labels[$job['process_label']] = NULL;
}
}
foreach ($labels as $process_label => $item_labels) {
if (is_null($item_labels)) {
$message_pieces[] = $process_label;
}
else {
$message_pieces[] = t('@task for @items', array(
'@task' => $process_label,
'@items' => implode(', ', $item_labels),
));
}
}
$context['message'] = t("Processed: @list.", array(
'@list' => implode(', ', $message_pieces),
));
}