You are here

interface ContextDefinitionInterface in Typed Data API enhancements 8

Context definition information required by Typed Data.

The core interface is extended to add properties that are necessary for Typed Data.

Hierarchy

Expanded class hierarchy of ContextDefinitionInterface

All classes that implement ContextDefinitionInterface

File

src/Context/ContextDefinitionInterface.php, line 13

Namespace

Drupal\typed_data\Context
View source
interface ContextDefinitionInterface extends ContextDefinitionInterfaceCore {

  /**
   * Constants for the context assignment restriction mode.
   *
   * @see ::getAssignmentRestriction()
   */
  const ASSIGNMENT_RESTRICTION_INPUT = 'input';
  const ASSIGNMENT_RESTRICTION_SELECTOR = 'selector';

  /**
   * Determines if the context value is allowed to be NULL.
   *
   * @return bool
   *   TRUE if NULL values are allowed, FALSE otherwise.
   */
  public function isAllowedNull();

  /**
   * Sets the "allow NULL value" behavior.
   *
   * @param bool $null_allowed
   *   TRUE if NULL values should be allowed, FALSE otherwise.
   *
   * @return $this
   */
  public function setAllowNull($null_allowed);

  /**
   * Determines if this context has an assignment restriction.
   *
   * @return string|null
   *   Either ASSIGNMENT_RESTRICTION_INPUT for contexts that are only allowed to
   *   be provided as input values, ASSIGNMENT_RESTRICTION_SELECTOR for contexts
   *   that must be provided as data selectors or NULL if there is no
   *   restriction for this context.
   */
  public function getAssignmentRestriction();

  /**
   * Sets the assignment restriction mode for this context.
   *
   * @param string|null $restriction
   *   Either ASSIGNMENT_RESTRICTION_INPUT for contexts that are only allowed to
   *   be provided as input values, ASSIGNMENT_RESTRICTION_SELECTOR for contexts
   *   that must be provided as data selectors or NULL if there is no
   *   restriction for this context.
   *
   * @return $this
   */
  public function setAssignmentRestriction($restriction);

  /**
   * Exports the definition as an array.
   *
   * @return array
   *   An array with values for all definition keys.
   */
  public function toArray();

}

Members

Namesort descending Modifiers Type Description Overrides
ContextDefinitionInterface::addConstraint public function Adds a validation constraint. 1
ContextDefinitionInterface::ASSIGNMENT_RESTRICTION_INPUT constant Constants for the context assignment restriction mode.
ContextDefinitionInterface::ASSIGNMENT_RESTRICTION_SELECTOR constant
ContextDefinitionInterface::getAssignmentRestriction public function Determines if this context has an assignment restriction. 1
ContextDefinitionInterface::getConstraint public function Gets a validation constraint. 1
ContextDefinitionInterface::getConstraints public function Gets an array of validation constraints. 1
ContextDefinitionInterface::getDataDefinition public function Returns the data definition of the defined context. 1
ContextDefinitionInterface::getDataType public function Gets the data type needed by the context. 1
ContextDefinitionInterface::getDefaultValue public function Gets the default value for this context definition. 1
ContextDefinitionInterface::getDescription public function Gets a human readable description. 1
ContextDefinitionInterface::getLabel public function Gets a human readable label. 1
ContextDefinitionInterface::isAllowedNull public function Determines if the context value is allowed to be NULL. 1
ContextDefinitionInterface::isMultiple public function Determines whether the data is multi-valued, i.e. a list of data items. 1
ContextDefinitionInterface::isRequired public function Determines whether the context is required. 1
ContextDefinitionInterface::isSatisfiedBy public function Determines if this definition is satisfied by a context object. 1
ContextDefinitionInterface::setAllowNull public function Sets the "allow NULL value" behavior. 1
ContextDefinitionInterface::setAssignmentRestriction public function Sets the assignment restriction mode for this context. 1
ContextDefinitionInterface::setConstraints public function Sets the array of validation constraints. 1
ContextDefinitionInterface::setDataType public function Sets the data type needed by the context. 1
ContextDefinitionInterface::setDefaultValue public function Sets the default data value. 1
ContextDefinitionInterface::setDescription public function Sets the human readable description. 1
ContextDefinitionInterface::setLabel public function Sets the human readable label. 1
ContextDefinitionInterface::setMultiple public function Sets whether the data is multi-valued. 1
ContextDefinitionInterface::setRequired public function Sets whether the data is required. 1
ContextDefinitionInterface::toArray public function Exports the definition as an array. 1