Context
class Context implements ContextInterface (View source)
A generic context class for wrapping data a plugin needs to operate.
Properties
| protected mixed | $contextValue | The value of the context. |
|
| protected ContextDefinitionInterface | $contextDefinition | The definition to which a context must conform. |
Methods
__construct(ContextDefinitionInterface $context_definition, mixed|null $context_value = NULL)
Create a context object.
mixed
getContextValue()
Gets the context value.
bool
hasContextValue()
Returns whether the context has a value.
getContextDefinition()
Gets the provided definition that the context must conform to.
array
getConstraints()
Gets a list of validation constraints.
ConstraintViolationListInterface
validate()
Validates the set context value.
Details
__construct(ContextDefinitionInterface $context_definition, mixed|null $context_value = NULL)
Create a context object.
mixed
getContextValue()
Gets the context value.
bool
hasContextValue()
Returns whether the context has a value.
ContextDefinitionInterface
getContextDefinition()
Gets the provided definition that the context must conform to.
array
getConstraints()
Gets a list of validation constraints.
ConstraintViolationListInterface
validate()
Validates the set context value.