function ListDataDefinition::getClass
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::getClass()
- 10 core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::getClass()
- 11.x core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::getClass()
Overrides DataDefinition::getClass
2 calls to ListDataDefinition::getClass()
- BaseFieldDefinition::getDefaultValue in core/
lib/ Drupal/ Core/ Field/ BaseFieldDefinition.php - Returns the default value for the field in a newly created entity.
- FieldDefinition::getDefaultValue in core/
lib/ Drupal/ Core/ Field/ FieldDefinition.php - Returns the default value for the field in a newly created entity.
File
-
core/
lib/ Drupal/ Core/ TypedData/ ListDataDefinition.php, line 74
Class
- ListDataDefinition
- A typed data definition class for defining lists.
Namespace
Drupal\Core\TypedDataCode
public function getClass() {
if (!empty($this->definition['class'])) {
return $this->definition['class'];
}
// If a list definition is used but no class has been specified, derive the
// default list class from the item type.
$item_type_definition = \Drupal::typedDataManager()->getDefinition($this->getItemDefinition()
->getDataType());
if (!$item_type_definition) {
throw new \LogicException("An invalid data type '{$this->getItemDefinition()->getDataType()}' has been specified for list items");
}
return $item_type_definition['list_class'];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.