You are here

public function ContainerAwarePluginManager::getDefinition in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/Plugin/ContainerAwarePluginManager.php \Drupal\service_container\Plugin\ContainerAwarePluginManager::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.

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 DiscoveryInterface::getDefinition

1 call to ContainerAwarePluginManager::getDefinition()
ContainerAwarePluginManager::createInstance in src/Plugin/ContainerAwarePluginManager.php
Creates a pre-configured instance of a plugin.

File

src/Plugin/ContainerAwarePluginManager.php, line 32
Contains \Drupal\service_container\Plugin\ContainerAwarePluginManager

Class

ContainerAwarePluginManager
Base class for plugin managers.

Namespace

Drupal\service_container\Plugin

Code

public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
  return $this->container
    ->getDefinition($this->servicePrefix . $plugin_id, $exception_on_invalid);
}