public function NodeTranslationMigrateSubscriber::onPostRowSave in Drupal 9
Same name and namespace in other branches
- 8 core/modules/node/src/EventSubscriber/NodeTranslationMigrateSubscriber.php \Drupal\node\EventSubscriber\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 redirections.
Namespace
Drupal\node\EventSubscriberCode
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'],
]);
}
}