ListDataDefinition::getClass
public function ListDataDefinition::getClass
public ListDataDefinition::getClass()
Returns the class used for creating the typed data object.
If not specified, the default class of the data type will be returned.
Return value
string The class used for creating the typed data object.
Overrides DataDefinition::getClass
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() { $class = isset($this->definition['class']) ? $this->definition['class'] : NULL; if (!empty($class)) { return $class; } else { // 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']; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!TypedData!ListDataDefinition.php/function/ListDataDefinition::getClass/8.1.x