You are here

public function ViewsBulkOperationsActionManager::getDefinition 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::getDefinition()
  2. 8.2 src/Service/ViewsBulkOperationsActionManager.php \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionManager::getDefinition()
  3. 4.0.x src/Service/ViewsBulkOperationsActionManager.php \Drupal\views_bulk_operations\Service\ViewsBulkOperationsActionManager::getDefinition()

Gets a specific plugin definition.

Parameters

string $plugin_id: A plugin id.

bool $exception_on_invalid: (optional) If TRUE, an invalid plugin ID will throw an exception.

array $parameters: Parameters of the method. Passed to alter event.

Return value

mixed A plugin definition, or NULL if the plugin ID is invalid and $exception_on_invalid is FALSE.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if $plugin_id is invalid and $exception_on_invalid is TRUE.

Overrides DiscoveryCachedTrait::getDefinition

File

src/Service/ViewsBulkOperationsActionManager.php, line 131

Class

ViewsBulkOperationsActionManager
Defines Views Bulk Operations action manager.

Namespace

Drupal\views_bulk_operations\Service

Code

public function getDefinition($plugin_id, $exception_on_invalid = TRUE, array $parameters = []) {

  // Loading all definitions here will not hurt much, as they're cached,
  // and we need the option to alter a definition.
  $definitions = $this
    ->getDefinitions($parameters);
  if (isset($definitions[$plugin_id])) {
    return $definitions[$plugin_id];
  }
  elseif (!$exception_on_invalid) {
    return NULL;
  }
  throw new PluginNotFoundException($plugin_id, sprintf('The "%s" plugin does not exist.', $plugin_id));
}