You are here

interface ContextInterface in Zircon Profile 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Plugin/Context/ContextInterface.php \Drupal\Core\Plugin\Context\ContextInterface
  2. 8 core/lib/Drupal/Component/Plugin/Context/ContextInterface.php \Drupal\Component\Plugin\Context\ContextInterface
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/Plugin/Context/ContextInterface.php \Drupal\Component\Plugin\Context\ContextInterface

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

Hierarchy

Expanded class hierarchy of ContextInterface

All classes that implement ContextInterface

5 files declare their use of ContextInterface
ConditionPluginCollection.php in core/lib/Drupal/Core/Condition/ConditionPluginCollection.php
Contains \Drupal\Core\Condition\ConditionPluginCollection.
ContextAwarePluginBase.php in core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
Contains \Drupal\Core\Plugin\ContextAwarePluginBase.
ContextAwarePluginBase.php in core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
Contains \Drupal\Component\Plugin\ContextAwarePluginBase.
ContextAwarePluginInterface.php in core/lib/Drupal/Component/Plugin/ContextAwarePluginInterface.php
Contains \Drupal\Component\Plugin\ContextAwarePluginInterface.
ContextInterface.php in core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
Contains \Drupal\Core\Plugin\Context\ContextInterface.

File

core/lib/Drupal/Component/Plugin/Context/ContextInterface.php, line 13
Contains \Drupal\Component\Plugin\Context\ContextInterface.

Namespace

Drupal\Component\Plugin\Context
View source
interface ContextInterface {

  /**
   * Gets the context value.
   *
   * @return mixed
   *   The currently set context value, or NULL if it is not set.
   */
  public function getContextValue();

  /**
   * Returns whether the context has a value.
   *
   * @return bool
   *   TRUE if the context has a value, FALSE otherwise.
   */
  public function hasContextValue();

  /**
   * Gets the provided definition that the context must conform to.
   *
   * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
   *   The defining characteristic representation of the context.
   */
  public function getContextDefinition();

  /**
   * Gets a list of validation constraints.
   *
   * @return array
   *   Array of constraints, each being an instance of
   *   \Symfony\Component\Validator\Constraint.
   */
  public function getConstraints();

  /**
   * Validates the set context value.
   *
   * @return \Symfony\Component\Validator\ConstraintViolationListInterface
   *   A list of constraint violations. If the list is empty, validation
   *   succeeded.
   */
  public function validate();

}

Members

Namesort descending Modifiers Type Description Overrides
ContextInterface::getConstraints public function Gets a list of validation constraints. 1
ContextInterface::getContextDefinition public function Gets the provided definition that the context must conform to. 2
ContextInterface::getContextValue public function Gets the context value. 1
ContextInterface::hasContextValue public function Returns whether the context has a value. 1
ContextInterface::validate public function Validates the set context value. 1