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

Breadcrumb

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

function Context::getConstraints

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::getConstraints()

Overrides ContextInterface::getConstraints

1 call to Context::getConstraints()
Context::validate in core/lib/Drupal/Component/Plugin/Context/Context.php
Validates the set context value.
1 method overrides Context::getConstraints()
Context::getConstraints in core/lib/Drupal/Core/Plugin/Context/Context.php
Gets a list of validation constraints.

File

core/lib/Drupal/Component/Plugin/Context/Context.php, line 78

Class

Context
A generic context class for wrapping data a plugin needs to operate.

Namespace

Drupal\Component\Plugin\Context

Code

public function getConstraints() {
    if (empty($this->contextDefinition['class'])) {
        throw new ContextException("An error was encountered while trying to validate the context.");
    }
    return [
        new Type($this->contextDefinition['class']),
    ];
}

API Navigation

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