function ContextAwarePluginBase::getContextDefinition
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php \Drupal\Core\Plugin\ContextAwarePluginBase::getContextDefinition()
- 8.9.x core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase::getContextDefinition()
Overrides ContextAwarePluginInterface::getContextDefinition
3 calls to ContextAwarePluginBase::getContextDefinition()
- ContextAwarePluginBase::createContextFromConfiguration in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Creates context objects from any context mappings in configuration.
- ContextAwarePluginBase::getContext in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Gets a defined context.
- ContextAwarePluginBase::setContextValue in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Sets the value for a defined context.
File
-
core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php, line 92
Class
- ContextAwarePluginBase
- Base class for plugins that are context aware.
Namespace
Drupal\Component\PluginCode
public function getContextDefinition($name) {
$definition = $this->getPluginDefinition();
if ($definition instanceof ContextAwarePluginDefinitionInterface) {
if ($definition->hasContextDefinition($name)) {
return $definition->getContextDefinition($name);
}
}
elseif (!empty($definition['context_definitions'][$name])) {
return $definition['context_definitions'][$name];
}
throw new ContextException(sprintf("The %s context is not a valid context.", $name));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.