You are here

private function Importer::updatePathAliasTargetId in Default Content Deploy 8

Rewrite path aliases to target entity IDs that were assigned during import.

Parameters

$decode:

Return value

$this

1 call to Importer::updatePathAliasTargetId()
Importer::preDenormalize in src/Importer.php
This event is triggered before decoding to an entity.

File

src/Importer.php, line 619

Class

Importer
A service for handling import of default content.

Namespace

Drupal\default_content_deploy

Code

private function updatePathAliasTargetId(&$decode) {
  if ($alias = $decode['path'][0]['value'] ?? NULL) {
    if (preg_match('@^/(\\w+)/(\\d+)([/?#].*|)$@', $alias, $matches)) {
      $entity_type_id = str_replace('_', '/', $matches[1]);
      if ($uuid = $this->entityLookup[$entity_type_id][$matches[2]] ?? NULL) {
        if ($id = $this->entityIdLookup[$uuid] ?? NULL) {
          $decode['path'][0]['value'] = '/' . $matches[1] . '/' . $id . $matches[3];
        }
      }
    }
  }
  return $this;
}