function ContextAwarePluginTrait::getContexts

Same name in other branches
  1. 10 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContexts()
  2. 11.x core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContexts()
6 calls to ContextAwarePluginTrait::getContexts()
ContextAwarePluginTrait::getCacheContexts in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextAwarePluginTrait::getCacheMaxAge in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextAwarePluginTrait::getCacheTags in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextAwarePluginTrait::validateContexts in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
SectionStorageBase::getContextsDuringPreview in core/modules/layout_builder/src/Plugin/SectionStorage/SectionStorageBase.php
Gets contexts for use during preview.

... See full list

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php, line 46

Class

ContextAwarePluginTrait
Provides a trait to add context-aware functionality to plugins.

Namespace

Drupal\Core\Plugin

Code

public function getContexts() {
    // Make sure all context objects are initialized.
    foreach ($this->getContextDefinitions() as $name => $definition) {
        $this->getContext($name);
    }
    return $this->context;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.