function ContextAwarePluginBase::getContextDefinitions

Same name in this branch
  1. 8.9.x core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php \Drupal\Core\Plugin\ContextAwarePluginBase::getContextDefinitions()
Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase::getContextDefinitions()

Overrides ContextAwarePluginInterface::getContextDefinitions

3 calls to ContextAwarePluginBase::getContextDefinitions()
ContextAwarePluginBase::getContextDefinitions in core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
ContextAwarePluginBase::getContexts in core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
Gets the defined contexts.
ContextAwarePluginBase::getContextValues in core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
Gets the values for all defined contexts.
1 method overrides ContextAwarePluginBase::getContextDefinitions()
ContextAwarePluginBase::getContextDefinitions in core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php

File

core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php, line 95

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Component\Plugin

Code

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

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