Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NodeTranslationMigrateSubscriber.php

function NodeTranslationMigrateSubscriber::onPostRowSave

Maps the old nid to the new one in the key value collection.

Parameters

\Drupal\migrate\Event\MigratePostRowSaveEvent $event: The migrate post row save event.

File

core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php, line 79

Class

NodeTranslationMigrateSubscriber
Creates a key value collection for migrated node translation mappings.

Namespace

Drupal\node\EventSubscriber

Code

public function onPostRowSave(MigratePostRowSaveEvent $event) {
    if ($this->isNodeTranslationsMigration($event)) {
        $row = $event->getRow();
        $source = $row->getSource();
        $destination = $row->getDestination();
        $collection = $this->keyValue
            ->get('node_translation_redirect');
        $collection->set($source['nid'], [
            $destination['nid'],
            $destination['langcode'],
        ]);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal