You are here

public function ProcessedContentLoader::importEntity in YAML Content 8.2

Load an entity from a loaded import data outline.

Parameters

array $content_data: The loaded array of content data to populate into this entity.

Required keys:

  • `entity`: The entity type machine name.

Return value

\Drupal\Core\Entity\EntityInterface The built and imported content entity.

Throws

\Exception

Overrides ContentLoaderBase::importEntity

File

src/ContentLoader/ProcessedContentLoader.php, line 65

Class

ProcessedContentLoader
A ContentLoader supporting processing of content through plugins.

Namespace

Drupal\yaml_content\ContentLoader

Code

public function importEntity(array $content_data) {

  // Preprocess the content data.
  $entity_context = [];
  $this
    ->preprocessData($content_data, $entity_context);
  $entity = parent::importEntity($content_data);

  // Postprocess loaded entity object.
  $this
    ->postprocessData($content_data, $entity, $entity_context);
  return $entity;
}