function ListDataDefinition::setDataType

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::setDataType()
  2. 8.9.x core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::setDataType()
  3. 11.x core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::setDataType()

Overrides DataDefinition::setDataType

File

core/lib/Drupal/Core/TypedData/ListDataDefinition.php, line 65

Class

ListDataDefinition
A typed data definition class for defining lists.

Namespace

Drupal\Core\TypedData

Code

public function setDataType($type) {
    if ($type != 'list') {
        throw new \LogicException('Lists must always be of data type "list".');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.