function DataType::__construct
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/TypedData/Attribute/DataType.php \Drupal\Core\TypedData\Attribute\DataType::__construct()
Constructs a new DataType attribute.
Parameters
string $id: The data type plugin ID.
\Drupal\Core\StringTranslation\TranslatableMarkup $label: The human-readable name of the data type.
\Drupal\Core\StringTranslation\TranslatableMarkup|null $description: (optional) The description of the data type.
string|null $definition_class: (optional) The definition class to use for defining data of this type.
string|null $list_class: (optional) The typed data class used for wrapping multiple data items of the type.
string|null $list_definition_class: (optional) The definition class to use for defining a list of items of this type.
array $constraints: (optional) An array of validation constraints for this type.
bool $unwrap_for_canonical_representation: Whether the typed object wraps the canonical representation of the data.
class-string|null $deriver: (optional) The deriver class for the data type.
Overrides Plugin::__construct
See also
\Drupal\Core\TypedData\TypedDataManager::getConstraints()
\Drupal\Core\TypedData\TypedDataManager::getCanonicalRepresentation()
File
-
core/
lib/ Drupal/ Core/ TypedData/ Attribute/ DataType.php, line 68
Class
- DataType
- Defines a data type attribute.
Namespace
Drupal\Core\TypedData\AttributeCode
public function __construct(public readonly string $id, public readonly TranslatableMarkup $label, public readonly ?TranslatableMarkup $description = NULL, public readonly ?string $definition_class = DataDefinition::class, public readonly ?string $list_class = ItemList::class, public readonly ?string $list_definition_class = ListDataDefinition::class, public readonly array $constraints = [], public readonly bool $unwrap_for_canonical_representation = TRUE, public readonly ?string $deriver = NULL) {
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.