You are here

public function ViewsBulkOperationsActionProcessor::initialize in Views Bulk Operations (VBO) 4.0.x

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

Set values.

Parameters

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

mixed $view: The current view object or NULL.

Overrides ViewsBulkOperationsActionProcessorInterface::initialize

2 calls to ViewsBulkOperationsActionProcessor::initialize()
ViewsBulkOperationsActionProcessor::executeProcessing in src/Service/ViewsBulkOperationsActionProcessor.php
Helper function for processing results from view data.
ViewsBulkOperationsActionProcessor::getLabels in src/Service/ViewsBulkOperationsActionProcessor.php
Get the current processing entity queue.

File

src/Service/ViewsBulkOperationsActionProcessor.php, line 122

Class

ViewsBulkOperationsActionProcessor
Defines VBO action processor.

Namespace

Drupal\views_bulk_operations\Service

Code

public function initialize(array $view_data, $view = NULL) : void {

  // It may happen that the service was already initialized
  // in this request (e.g. multiple Batch API operation calls).
  // Clear the processing queue in such a case.
  if ($this->initialized) {
    $this->queue = [];
  }
  $this->excludeMode = !empty($view_data['exclude_mode']);
  if (isset($view_data['action_id'])) {
    if (!isset($view_data['configuration'])) {
      $view_data['configuration'] = [];
    }
    if (!empty($view_data['preconfiguration'])) {
      $view_data['configuration'] += $view_data['preconfiguration'];
    }

    // Initialize action object.
    $this->action = $this->actionManager
      ->createInstance($view_data['action_id'], $view_data['configuration']);

    // Set action context.
    $this
      ->setActionContext($view_data);
  }

  // Set entire view data as object parameter for future reference.
  $this->bulkFormData = $view_data;

  // Set the current view.
  $this
    ->setView($view);
  $this->initialized = TRUE;
}