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;
}
doc_Drupal
2016-10-29 09:04:56
Comments
Leave a Comment

Please login to continue.