annotate core/lib/Drupal/Component/Plugin/Context/ContextInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Component\Plugin\Context;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Provides data and definitions for plugins during runtime and administration.
Chris@0 7 *
Chris@0 8 * Plugin contexts are satisfied by ContextInterface implementing objects.
Chris@0 9 * These objects always contain a definition of what data they will provide
Chris@0 10 * during runtime. During run time, ContextInterface implementing objects must
Chris@0 11 * also provide the corresponding data value.
Chris@0 12 *
Chris@0 13 * @see \Drupal\Component\Plugin\Context\ContextDefinitionInterface
Chris@0 14 */
Chris@0 15 interface ContextInterface {
Chris@0 16
Chris@0 17 /**
Chris@0 18 * Gets the context value.
Chris@0 19 *
Chris@0 20 * @return mixed
Chris@0 21 * The currently set context value, or NULL if it is not set.
Chris@0 22 */
Chris@0 23 public function getContextValue();
Chris@0 24
Chris@0 25 /**
Chris@0 26 * Returns whether the context has a value.
Chris@0 27 *
Chris@0 28 * @return bool
Chris@0 29 * TRUE if the context has a value, FALSE otherwise.
Chris@0 30 */
Chris@0 31 public function hasContextValue();
Chris@0 32
Chris@0 33 /**
Chris@0 34 * Gets the provided definition that the context must conform to.
Chris@0 35 *
Chris@0 36 * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
Chris@0 37 * The defining characteristic representation of the context.
Chris@0 38 */
Chris@0 39 public function getContextDefinition();
Chris@0 40
Chris@0 41 /**
Chris@0 42 * Gets a list of validation constraints.
Chris@0 43 *
Chris@0 44 * @return array
Chris@0 45 * Array of constraints, each being an instance of
Chris@0 46 * \Symfony\Component\Validator\Constraint.
Chris@0 47 */
Chris@0 48 public function getConstraints();
Chris@0 49
Chris@0 50 /**
Chris@0 51 * Validates the set context value.
Chris@0 52 *
Chris@0 53 * @return \Symfony\Component\Validator\ConstraintViolationListInterface
Chris@0 54 * A list of constraint violations. If the list is empty, validation
Chris@0 55 * succeeded.
Chris@0 56 */
Chris@0 57 public function validate();
Chris@0 58
Chris@0 59 }