You are here

protected function Importer::loadEntityFromStorage in Tome 8

Loads an entity from the content storage.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type of this entity.

string $uuid: The entity UUID.

string $langcode: (optional) The langcode, for translations.

Return value

\Drupal\Core\Entity\ContentEntityInterface The loaded entity.

1 call to Importer::loadEntityFromStorage()
Importer::importContent in modules/tome_sync/src/Importer.php
Imports a content entity from the source storage.

File

modules/tome_sync/src/Importer.php, line 243

Class

Importer
Handles importing of content and file entities.

Namespace

Drupal\tome_sync

Code

protected function loadEntityFromStorage(EntityTypeInterface $entity_type, $uuid, $langcode = NULL) {
  $contents = $this->contentStorage
    ->read(TomeSyncHelper::getContentNameFromParts($entity_type
    ->id(), $uuid, $langcode));

  /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
  $entity = $this->serializer
    ->denormalize($contents, $entity_type
    ->getClass(), 'json');
  $entity->_tomeFields = array_keys($contents);
  return $entity;
}