You are here

public function EntityRevisionDataDefinition::getDataType in Entity Reference Revisions 8

Returns the data type of the data.

Return value

string The data type.

Overrides EntityDataDefinition::getDataType

File

src/TypedData/EntityRevisionDataDefinition.php, line 35

Class

EntityRevisionDataDefinition
A typed data definition class for describing entities.

Namespace

Drupal\entity_reference_revisions\TypedData

Code

public function getDataType() {
  $type = 'entity_revision';
  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;
}