public function ContextAwarePluginBase::getContextDefinitions in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase::getContextDefinitions()
Gets the context definitions of the plugin.
Return value
\Drupal\Component\Plugin\Context\ContextDefinitionInterface[] The array of context definitions, keyed by context name.
Overrides ContextAwarePluginInterface::getContextDefinitions
2 calls to ContextAwarePluginBase::getContextDefinitions()
- ContextAwarePluginBase::getContexts in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Gets the defined contexts.
- ContextAwarePluginBase::getContextValues in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Gets the values for all defined contexts.
File
- core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php, line 72
Class
- ContextAwarePluginBase
- Base class for plugins that are context aware.
Namespace
Drupal\Component\PluginCode
public function getContextDefinitions() {
$definition = $this
->getPluginDefinition();
if ($definition instanceof ContextAwarePluginDefinitionInterface) {
return $definition
->getContextDefinitions();
}
else {
return !empty($definition['context_definitions']) ? $definition['context_definitions'] : [];
}
}