You are here

public function ViewsBulkOperationsActionProcessor::executeProcessing in Views Bulk Operations (VBO) 8.2

Same name and namespace in other branches
  1. 8.3 src/Service/ViewsBulkOperationsActionProcessor.php \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor::executeProcessing()
  2. 8 src/Service/ViewsBulkOperationsActionProcessor.php \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor::executeProcessing()
  3. 4.0.x src/Service/ViewsBulkOperationsActionProcessor.php \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionProcessor::executeProcessing()

Helper function for processing results from view data.

Parameters

array $data: Data concerning the view that will be processed.

mixed $view: The current view object or NULL.

Overrides ViewsBulkOperationsActionProcessorInterface::executeProcessing

File

src/Service/ViewsBulkOperationsActionProcessor.php, line 392

Class

ViewsBulkOperationsActionProcessor
Defines VBO action processor.

Namespace

Drupal\views_bulk_operations\Service

Code

public function executeProcessing(array &$data, $view = NULL) {
  if ($data['batch']) {
    $batch = ViewsBulkOperationsBatch::getBatch($data);
    batch_set($batch);
  }
  else {
    $list = $data['list'];

    // Populate and process queue.
    if (!$this->initialized) {
      $this
        ->initialize($data, $view);
    }
    if (empty($list)) {
      $list = $this
        ->getPageList(0);
    }
    if ($this
      ->populateQueue($list)) {
      $batch_results = $this
        ->process();
    }
    $results = [
      'operations' => [],
    ];
    foreach ($batch_results as $result) {
      $results['operations'][] = (string) $result;
    }
    ViewsBulkOperationsBatch::finished(TRUE, $results, []);
  }
}