class NodeTranslationMigrateSubscriber implements EventSubscriberInterface (View source)

Creates a key value collection for migrated node translation redirections.

If we are migrating node translations from Drupal 6 or 7, these nodes will be combined with their source node. Since there still might be references to the URLs of these now consolidated nodes, this service saves the mapping between the old nids to the new ones to be able to redirect them to the right node in the right language.

The mapping is stored in the "node_translation_redirect" key/value collection and the redirection is made by the NodeTranslationExceptionSubscriber class.

Properties

protected KeyValueFactoryInterface $keyValue

The key value factory.

protected StateInterface $state

The state service.

Methods

__construct(KeyValueFactoryInterface $key_value, StateInterface $state)

Constructs the NodeTranslationMigrateSubscriber.

bool
isNodeTranslationsMigration(EventBase $event)

Helper method to check if we are migrating translated nodes.

onPostRowSave(MigratePostRowSaveEvent $event)

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

onPostImport(MigrateImportEvent $event)

Set the node_translation_redirect state to enable the redirections.

static array
getSubscribedEvents()

{@inheritdoc}

Details

__construct(KeyValueFactoryInterface $key_value, StateInterface $state)

Constructs the NodeTranslationMigrateSubscriber.

Parameters

KeyValueFactoryInterface $key_value

The key value factory.

StateInterface $state

The state service.

protected bool isNodeTranslationsMigration(EventBase $event)

Helper method to check if we are migrating translated nodes.

Parameters

EventBase $event

The migrate event.

Return Value

bool

True if we are migrating translated nodes, false otherwise.

onPostRowSave(MigratePostRowSaveEvent $event)

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

Parameters

MigratePostRowSaveEvent $event

The migrate post row save event.

onPostImport(MigrateImportEvent $event)

Set the node_translation_redirect state to enable the redirections.

Parameters

MigrateImportEvent $event

The migrate import event.

static array getSubscribedEvents()

{@inheritdoc}

Return Value

array