You are here

protected function ContentImporter::alterPathAlias in Content Synchronization 3.0.x

Replaces a path to a node with an actual one.

Parameters

array $decoded_entity: Array of entity values.

Return value

array Array of entity values with the path values changed.

1 call to ContentImporter::alterPathAlias()
ContentImporter::importEntity in src/Importer/ContentImporter.php

File

src/Importer/ContentImporter.php, line 182

Class

ContentImporter

Namespace

Drupal\content_sync\Importer

Code

protected function alterPathAlias(array $decoded_entity) {
  $referenced_entity_uuid = reset($decoded_entity["_content_sync"]["path_alias"]);
  $referenced_entity_type = key($decoded_entity["_content_sync"]["path_alias"]);
  if ($referenced_entity = \Drupal::service('entity.repository')
    ->loadEntityByUuid($referenced_entity_type, $referenced_entity_uuid)) {
    $decoded_entity["path"][0]["value"] = '/' . $referenced_entity_type . '/' . $referenced_entity
      ->id();
  }
  return $decoded_entity;
}