3 namespace Drupal\Component\Plugin\Context;
6 * Provides data and definitions for plugins during runtime and administration.
8 * Plugin contexts are satisfied by ContextInterface implementing objects.
9 * These objects always contain a definition of what data they will provide
10 * during runtime. During run time, ContextInterface implementing objects must
11 * also provide the corresponding data value.
13 * @see \Drupal\Component\Plugin\Context\ContextDefinitionInterface
15 interface ContextInterface {
18 * Gets the context value.
21 * The currently set context value, or NULL if it is not set.
23 public function getContextValue();
26 * Returns whether the context has a value.
29 * TRUE if the context has a value, FALSE otherwise.
31 public function hasContextValue();
34 * Gets the provided definition that the context must conform to.
36 * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
37 * The defining characteristic representation of the context.
39 public function getContextDefinition();
42 * Gets a list of validation constraints.
45 * Array of constraints, each being an instance of
46 * \Symfony\Component\Validator\Constraint.
48 public function getConstraints();
51 * Validates the set context value.
53 * @return \Symfony\Component\Validator\ConstraintViolationListInterface
54 * A list of constraint violations. If the list is empty, validation
57 public function validate();