public function ContextAwarePluginBase::getContexts in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase::getContexts()
Gets the defined contexts.
Return value
array The set context objects.
Throws
\Drupal\Component\Plugin\Exception\PluginException If contexts are defined but not set.
Overrides ContextAwarePluginInterface::getContexts
6 calls to ContextAwarePluginBase::getContexts()
- ContextAwarePluginBase::getCacheContexts in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginBase.php - The cache contexts associated with this object.
- ContextAwarePluginBase::getCacheMaxAge in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginBase.php - The maximum age for which this object may be cached.
- ContextAwarePluginBase::getCacheTags in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginBase.php - The cache tags associated with this object.
- ContextAwarePluginBase::validateContexts in core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php - Validates the set values for the defined contexts.
- SectionStorageBase::getContextsDuringPreview in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ SectionStorageBase.php - Gets contexts for use during preview.
File
- core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php, line 124
Class
- ContextAwarePluginBase
- Base class for plugins that are context aware.
Namespace
Drupal\Component\PluginCode
public function getContexts() {
// Make sure all context objects are initialized.
foreach ($this
->getContextDefinitions() as $name => $definition) {
$this
->getContext($name);
}
return $this->context;
}