Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContextAwarePluginTrait.php

function ContextAwarePluginTrait::getContext

Return value

\Drupal\Core\Plugin\Context\ContextInterface The context object.

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

File

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

Class

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

Namespace

Drupal\Core\Plugin

Code

public function getContext($name) {
    // Check for a valid context value.
    if (!isset($this->context[$name])) {
        $this->context[$name] = new Context($this->getContextDefinition($name));
    }
    return $this->context[$name];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal