You are here

public function ContextAwarePluginTrait::getContextDefinitions in Drupal 9

Return value

\Drupal\Core\Plugin\Context\ContextDefinitionInterface[]

2 calls to ContextAwarePluginTrait::getContextDefinitions()
ContextAwarePluginTrait::getContexts in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php
ContextAwarePluginTrait::getContextValues in core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php

File

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

Class

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

Namespace

Drupal\Core\Plugin

Code

public function getContextDefinitions() {
  $definition = $this
    ->getPluginDefinition();
  if ($definition instanceof ContextAwarePluginDefinitionInterface) {
    return $definition
      ->getContextDefinitions();
  }
  return !empty($definition['context_definitions']) ? $definition['context_definitions'] : [];
}