public function EntityDataDefinition::getDataType

public EntityDataDefinition::getDataType()

Returns the data type of the data.

Return value

string The data type.

Overrides DataDefinition::getDataType

File

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

Class

EntityDataDefinition
A typed data definition class for describing entities.

Namespace

Drupal\Core\Entity\TypedData

Code

public function getDataType() {
  $type = 'entity';
  if ($entity_type = $this->getEntityTypeId()) {
    $type .= ':' . $entity_type;
    // Append the bundle only if we know it for sure and it is not the default
    // bundle.
    if (($bundles = $this->getBundles()) && count($bundles) == 1) {
      $bundle = reset($bundles);
      if ($bundle != $entity_type) {
        $type .= ':' . $bundle;
      }
    }
  }
  return $type;
}

© 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::getDataType/8.1.x