You are here

public function ViewsBulkOperationsBulkForm::init in Views Bulk Operations (VBO) 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::init()
  2. 8.2 src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::init()
  3. 4.0.x src/Plugin/views/field/ViewsBulkOperationsBulkForm.php \Drupal\views_bulk_operations\Plugin\views\field\ViewsBulkOperationsBulkForm::init()

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides FieldPluginBase::init

File

src/Plugin/views/field/ViewsBulkOperationsBulkForm.php, line 161

Class

ViewsBulkOperationsBulkForm
Defines the Views Bulk Operations field plugin.

Namespace

Drupal\views_bulk_operations\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  // Initialize VBO View Data object.
  $this->viewData
    ->init($view, $display, $this->options['relationship']);

  // Fetch actions.
  $this->actions = [];
  $entity_types = $this->viewData
    ->getEntityTypeIds();

  // Get actions only if there are any entity types set for the view.
  if (!empty($entity_types)) {
    foreach ($this->actionManager
      ->getDefinitions() as $id => $definition) {
      if (empty($definition['type']) || in_array($definition['type'], $entity_types, TRUE)) {
        $this->actions[$id] = $definition;
      }
    }
  }

  // Initialize tempstore object.
  $tempstore_name = 'views_bulk_operations_' . $view
    ->id() . '_' . $view->current_display;
  $this->userTempStore = $this->tempStoreFactory
    ->get($tempstore_name);

  // Force form_step setting to TRUE due to #2879310.
  $this->options['form_step'] = TRUE;
}