ContextDefinitionInterface
interface ContextDefinitionInterface implements ContextDefinitionInterface (View source)
Interface to define definition objects in ContextInterface via TypedData.
Methods
Sets the human readable description.
Sets the data type needed by the context.
Determines whether the data is multi-valued, i.e. a list of data items.
Sets whether the data is multi-valued.
Sets whether the data is required.
Gets the default value for this context definition.
Sets the default data value.
Sets the array of validation constraints.
Adds a validation constraint.
Gets a validation constraint.
Returns the data definition of the defined context.
Determines if this definition is satisfied by a context object.
Details
string
getLabel()
Gets a human readable label.
$this
setLabel(string $label)
Sets the human readable label.
string|null
getDescription()
Gets a human readable description.
$this
setDescription(string|null $description)
Sets the human readable description.
string
getDataType()
Gets the data type needed by the context.
If the context is multiple-valued, this represents the type of each value.
$this
setDataType(string $data_type)
Sets the data type needed by the context.
bool
isMultiple()
Determines whether the data is multi-valued, i.e. a list of data items.
$this
setMultiple(bool $multiple = TRUE)
Sets whether the data is multi-valued.
bool
isRequired()
Determines whether the context is required.
For required data a non-NULL value is mandatory.
$this
setRequired(bool $required = TRUE)
Sets whether the data is required.
mixed
getDefaultValue()
Gets the default value for this context definition.
$this
setDefaultValue(mixed $default_value)
Sets the default data value.
array
getConstraints()
Gets an array of validation constraints.
$this
setConstraints(array $constraints)
Sets the array of validation constraints.
NOTE: This will override any previously set constraints. In most cases ContextDefinitionInterface::addConstraint() should be used instead.
$this
addConstraint(string $constraint_name, array|null $options = NULL)
Adds a validation constraint.
array
getConstraint(string $constraint_name)
Gets a validation constraint.
DataDefinitionInterface
getDataDefinition()
Returns the data definition of the defined context.
bool
isSatisfiedBy(ContextInterface $context)
Determines if this definition is satisfied by a context object.