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

Breadcrumb

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

function Context::getContextData

Overrides ContextInterface::getContextData

1 call to Context::getContextData()
Context::hasContextValue in core/lib/Drupal/Core/Plugin/Context/Context.php
Returns whether the context has a value.

File

core/lib/Drupal/Core/Plugin/Context/Context.php, line 117

Class

Context
A Drupal specific context wrapper class.

Namespace

Drupal\Core\Plugin\Context

Code

public function getContextData() {
    if (!isset($this->contextData)) {
        $definition = $this->getContextDefinition();
        $default_value = $definition->getDefaultValue();
        // Store the default value so that subsequent calls don't have to look
        // it up again.
        $this->contextData = $this->getTypedDataManager()
            ->create($definition->getDataDefinition(), $default_value);
    }
    return $this->contextData;
}

API Navigation

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