function ExportMetadata::__construct

File

core/lib/Drupal/Core/DefaultContent/ExportMetadata.php, line 22

Class

ExportMetadata
Collects metadata about an entity being exported.

Namespace

Drupal\Core\DefaultContent

Code

public function __construct(ContentEntityInterface $entity) {
  $this->metadata['entity_type'] = $entity->getEntityTypeId();
  $this->metadata['uuid'] = $entity->uuid();
  $entity_type = $entity->getEntityType();
  if ($entity_type->hasKey('bundle')) {
    $this->metadata['bundle'] = $entity->bundle();
  }
  if ($entity_type->hasKey('langcode')) {
    $this->metadata['default_langcode'] = $entity->language()
      ->getId();
  }
}

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