public function ContextAwarePluginBase::getContextDefinition

Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextDefinition().

Overrides ContextAwarePluginInterface::getContextDefinition

File

drupal/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php, line 64
Contains \Drupal\Component\Plugin\ContextAwarePluginBase

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Component\Plugin

Code

public function getContextDefinition($name) {
  $definition = $this
    ->getPluginDefinition();
  if (empty($definition['context'][$name])) {
    throw new PluginException("The {$name} context is not a valid context.");
  }
  return $definition['context'][$name];
}