You are here

public function ContextAwarePluginTrait::getContexts in Drupal 10

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContexts()
1 call to ContextAwarePluginTrait::getContexts()
SimpleConfigSectionStorage::getContextsDuringPreview in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
Gets contexts for use during preview.

File

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

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;
}