"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/TypedData/Annotation/DataType.php" (26 Nov 2020, 3133 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "DataType.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\TypedData\Annotation;
    4 
    5 use Drupal\Component\Annotation\Plugin;
    6 
    7 /**
    8  * Defines a data type annotation object.
    9  *
   10  * The typed data API allows modules to support any kind of data based upon
   11  * pre-defined primitive types and interfaces for complex data and lists.
   12  *
   13  * Defined data types may map to one of the pre-defined primitive types in
   14  * \Drupal\Core\TypedData\Primitive or may be complex data types, containing on
   15  * or more data properties. Typed data objects for complex data types have to
   16  * implement the \Drupal\Core\TypedData\ComplexDataInterface. Further interface
   17  * that may be implemented are:
   18  *  - \Drupal\Core\Access\AccessibleInterface
   19  *  - \Drupal\Core\TypedData\TranslatableInterface
   20  *
   21  * Furthermore, lists of data items are represented by objects implementing the
   22  * \Drupal\Core\TypedData\ListInterface. A list contains items of the same data
   23  * type, is ordered and may contain duplicates. The class used for a list of
   24  * items of a certain type may be specified using the 'list class' key.
   25  *
   26  * @see \Drupal::typedDataManager()
   27  * @see \Drupal\Core\TypedData\TypedDataManager::create()
   28  * @see hook_data_type_info_alter()
   29  *
   30  * @ingroup typed_data
   31  *
   32  * @Annotation
   33  */
   34 class DataType extends Plugin {
   35 
   36   /**
   37    * The data type plugin ID.
   38    *
   39    * @var string
   40    */
   41   public $id;
   42 
   43   /**
   44    * The human-readable name of the data type.
   45    *
   46    * @ingroup plugin_translatable
   47    *
   48    * @var \Drupal\Core\Annotation\Translation
   49    */
   50   public $label;
   51 
   52   /**
   53    * The description of the data type.
   54    *
   55    * @ingroup plugin_translatable
   56    *
   57    * @var \Drupal\Core\Annotation\Translation
   58    */
   59   public $description;
   60 
   61   /**
   62    * The definition class to use for defining data of this type.
   63    * Must implement the \Drupal\Core\TypedData\DataDefinitionInterface.
   64    *
   65    * @var string
   66    */
   67   public $definition_class = '\Drupal\Core\TypedData\DataDefinition';
   68 
   69   /**
   70    * The typed data class used for wrapping multiple data items of the type.
   71    * Must implement the \Drupal\Core\TypedData\ListInterface.
   72    *
   73    * @var string
   74    */
   75   public $list_class = '\Drupal\Core\TypedData\Plugin\DataType\ItemList';
   76 
   77   /**
   78    * The definition class to use for defining a list of items of this type.
   79    * Must implement the \Drupal\Core\TypedData\ListDataDefinitionInterface.
   80    *
   81    * @var string
   82    */
   83   public $list_definition_class = '\Drupal\Core\TypedData\ListDataDefinition';
   84 
   85   /**
   86    * The pre-defined primitive type that this data type maps to.
   87    *
   88    * If set, it must be a constant defined by \Drupal\Core\TypedData\Primitive
   89    * such as \Drupal\Core\TypedData\Primitive::STRING.
   90    *
   91    * @var string
   92    */
   93   public $primitive_type;
   94 
   95   /**
   96    * An array of validation constraints for this type.
   97    *
   98    * @var array
   99    *
  100    * @see \Drupal\Core\TypedData\TypedDataManager::getConstraints().
  101    */
  102   public $constraints;
  103 
  104   /**
  105    * Whether the typed object wraps the canonical representation of the data.
  106    *
  107    * @var bool
  108    *
  109    * @see \Drupal\Core\TypedData\TypedDataManager::getCanonicalRepresentation()
  110    */
  111   public $unwrap_for_canonical_representation = TRUE;
  112 
  113 }