protected function DerivativeDiscoveryDecorator::getDeriver in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver()
Gets a deriver for a base plugin.
Parameters
string $base_plugin_id: The base plugin id of the plugin.
mixed $base_definition: The base plugin definition to build derivatives.
Return value
\Drupal\Component\Plugin\Derivative\DeriverInterface|null A DerivativeInterface or NULL if none exists for the plugin.
Throws
\Drupal\Component\Plugin\Exception\InvalidDeriverException Thrown if the 'deriver' class specified in the plugin definition does not implement \Drupal\Component\Plugin\Derivative\DeriverInterface.
2 calls to DerivativeDiscoveryDecorator::getDeriver()
- DerivativeDiscoveryDecorator::getDefinition in lib/
Drupal/ Component/ Plugin/ Discovery/ DerivativeDiscoveryDecorator.php - DerivativeDiscoveryDecorator::getDerivatives in lib/
Drupal/ Component/ Plugin/ Discovery/ DerivativeDiscoveryDecorator.php - Adds derivatives to a list of plugin definitions.
File
- lib/
Drupal/ Component/ Plugin/ Discovery/ DerivativeDiscoveryDecorator.php, line 183 - Contains \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator.
Class
- DerivativeDiscoveryDecorator
- Base class providing the tools for a plugin discovery to be derivative aware.
Namespace
Drupal\Component\Plugin\DiscoveryCode
protected function getDeriver($base_plugin_id, $base_definition) {
if (!isset($this->derivers[$base_plugin_id])) {
$this->derivers[$base_plugin_id] = FALSE;
$class = $this
->getDeriverClass($base_definition);
if ($class) {
$this->derivers[$base_plugin_id] = new $class($base_plugin_id);
}
}
return $this->derivers[$base_plugin_id] ?: NULL;
}