You are here

public function ViewsBulkOperationsActionManager::processDefinition in Views Bulk Operations (VBO) 8

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

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

1 call to ViewsBulkOperationsActionManager::processDefinition()
ViewsBulkOperationsActionManager::findDefinitions in src/Service/ViewsBulkOperationsActionManager.php
Finds plugin definitions.

File

src/Service/ViewsBulkOperationsActionManager.php, line 148

Class

ViewsBulkOperationsActionManager
Defines Views Bulk Operations action manager.

Namespace

Drupal\views_bulk_operations\Service

Code

public function processDefinition(&$definition, $plugin_id) {

  // Only arrays can be operated on.
  if (!is_array($definition)) {
    return;
  }
  if (!empty($this->defaults) && is_array($this->defaults)) {
    $definition = NestedArray::mergeDeep($this->defaults, $definition);
  }

  // Merge in defaults.
  $definition += [
    'confirm' => FALSE,
    'pass_context' => FALSE,
    'pass_view' => FALSE,
  ];

  // Add default confirmation form if confirm set to TRUE
  // and not explicitly set.
  if ($definition['confirm'] && empty($definition['confirm_form_route_name'])) {
    $definition['confirm_form_route_name'] = 'views_bulk_operations.confirm';
  }
}