You are here

public function ViewsBulkOperationsActionBase::setContext in Views Bulk Operations (VBO) 8

Same name and namespace in other branches
  1. 8.3 src/Action/ViewsBulkOperationsActionBase.php \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase::setContext()
  2. 8.2 src/Action/ViewsBulkOperationsActionBase.php \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase::setContext()
  3. 4.0.x src/Action/ViewsBulkOperationsActionBase.php \Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase::setContext()

Set action context.

Implementation should have an option to add data to the context, not overwrite it on every method execution.

Parameters

array $context: The context array.

Overrides ViewsBulkOperationsActionInterface::setContext

See also

ViewsBulkOperationsActionBase::setContext

File

src/Action/ViewsBulkOperationsActionBase.php, line 43

Class

ViewsBulkOperationsActionBase
Views Bulk Operations action plugin base.

Namespace

Drupal\views_bulk_operations\Action

Code

public function setContext(array &$context) {
  $this->context['sandbox'] =& $context['sandbox'];
  foreach ($context as $key => $item) {
    if ($key === 'sandbox') {
      continue;
    }
    $this->context[$key] = $item;
  }
}