You are here

protected function ViewsBulkOperationsActionManager::findDefinitions in Views Bulk Operations (VBO) 8.2

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

Finds plugin definitions.

Return value

array List of definitions to store in cache.

Overrides DefaultPluginManager::findDefinitions

1 call to ViewsBulkOperationsActionManager::findDefinitions()
ViewsBulkOperationsActionManager::getDefinitions in src/Service/ViewsBulkOperationsActionManager.php

File

src/Service/ViewsBulkOperationsActionManager.php, line 63

Class

ViewsBulkOperationsActionManager
Defines Views Bulk Operations action manager.

Namespace

Drupal\views_bulk_operations\Service

Code

protected function findDefinitions() {
  $definitions = $this
    ->getDiscovery()
    ->getDefinitions();

  // Incompatible actions.
  $incompatible = [
    'node_delete_action',
    'user_cancel_user_action',
  ];
  foreach ($definitions as $plugin_id => &$definition) {
    $this
      ->processDefinition($definition, $plugin_id);
    if (empty($definition) || in_array($definition['id'], $incompatible)) {
      unset($definitions[$plugin_id]);
    }
  }
  $this
    ->alterDefinitions($definitions);
  foreach ($definitions as $plugin_id => $plugin_definition) {

    // If the plugin definition is an object, attempt to convert it to an
    // array, if that is not possible, skip further processing.
    if (is_object($plugin_definition) && !($plugin_definition = (array) $plugin_definition)) {
      continue;
    }

    // If this plugin was provided by a module that does not exist, remove the
    // plugin definition.
    if (isset($plugin_definition['provider']) && !in_array($plugin_definition['provider'], [
      'core',
      'component',
    ]) && !$this
      ->providerExists($plugin_definition['provider'])) {
      unset($definitions[$plugin_id]);
    }
  }
  return $definitions;
}