public static function EntityDataDefinition::create

public static EntityDataDefinition::create($entity_type_id = NULL)

Creates a new entity definition.

Parameters

string $entity_type_id: (optional) The ID of the entity type, or NULL if the entity type is unknown. Defaults to NULL.

Return value

static

Overrides DataDefinition::create

File

core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php, line 21

Class

EntityDataDefinition
A typed data definition class for describing entities.

Namespace

Drupal\Core\Entity\TypedData

Code

public static function create($entity_type_id = NULL) {
  $definition = new static(array());
  // Set the passed entity type.
  if (isset($entity_type_id)) {
    $definition->setEntityTypeId($entity_type_id);
  }
  return $definition;
}

© 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!Entity!TypedData!EntityDataDefinition.php/function/EntityDataDefinition::create/8.1.x