public function DerivativeDiscoveryDecorator::getDefinition

Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinition().

Overrides DiscoveryInterface::getDefinition

File

drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php, line 36
Definition of Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator.

Class

DerivativeDiscoveryDecorator
Base class providing the tools for a plugin discovery to be derivative aware.

Namespace

Drupal\Component\Plugin\Discovery

Code

public function getDefinition($plugin_id) {
  list($base_plugin_id, $derivative_id) = $this
    ->decodePluginId($plugin_id);
  $plugin_definition = $this->decorated
    ->getDefinition($base_plugin_id);
  if (isset($plugin_definition)) {
    $derivative_fetcher = $this
      ->getDerivativeFetcher($base_plugin_id, $plugin_definition);
    if ($derivative_fetcher) {
      $plugin_definition = $derivative_fetcher
        ->getDerivativeDefinition($derivative_id, $plugin_definition);
    }
  }
  return $plugin_definition;
}