public static function ViewsBulkOperationsBatch::getBatch in Views Bulk Operations (VBO) 8
Same name and namespace in other branches
- 8.3 src/ViewsBulkOperationsBatch.php \Drupal\views_bulk_operations\ViewsBulkOperationsBatch::getBatch()
- 8.2 src/ViewsBulkOperationsBatch.php \Drupal\views_bulk_operations\ViewsBulkOperationsBatch::getBatch()
- 4.0.x src/ViewsBulkOperationsBatch.php \Drupal\views_bulk_operations\ViewsBulkOperationsBatch::getBatch()
Batch builder function.
Parameters
array $view_data: Processed view data.
1 call to ViewsBulkOperationsBatch::getBatch()
- ViewsBulkOperationsActionProcessor::executeProcessing in src/
Service/ ViewsBulkOperationsActionProcessor.php - Helper function for processing results from view data.
File
- src/
ViewsBulkOperationsBatch.php, line 189
Class
- ViewsBulkOperationsBatch
- Defines module Batch API methods.
Namespace
Drupal\views_bulk_operationsCode
public static function getBatch(array &$view_data) {
$current_class = get_called_class();
// Prepopulate results.
if (empty($view_data['list'])) {
// Redirect this batch to the processing URL and set
// previous redirect under a different key for later use.
$view_data['redirect_after_processing'] = $view_data['redirect_url'];
$view_data['redirect_url'] = Url::fromRoute('views_bulk_operations.execute_batch', [
'view_id' => $view_data['view_id'],
'display_id' => $view_data['display_id'],
]);
$batch = [
'title' => static::t('Prepopulating entity list for processing.'),
'operations' => [
[
[
$current_class,
'getList',
],
[
$view_data,
],
],
],
'progress_message' => static::t('Prepopulating, estimated time left: @estimate, elapsed: @elapsed.'),
'finished' => [
$current_class,
'saveList',
],
];
}
else {
$batch = [
'title' => static::t('Performing @operation on selected entities.', [
'@operation' => $view_data['action_label'],
]),
'operations' => [
[
[
$current_class,
'operation',
],
[
$view_data,
],
],
],
'progress_message' => static::t('Processing, estimated time left: @estimate, elapsed: @elapsed.'),
'finished' => [
$current_class,
'finished',
],
];
}
return $batch;
}