You are here

public function ContextAwarePluginTrait::getContextValues in Drupal 9

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContextValues()

File

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

Class

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

Namespace

Drupal\Core\Plugin

Code

public function getContextValues() {
  $values = [];
  foreach ($this
    ->getContextDefinitions() as $name => $definition) {
    $values[$name] = isset($this->context[$name]) ? $this->context[$name]
      ->getContextValue() : NULL;
  }
  return $values;
}