function NodeCompleteNodeTranslationLookup::transform

Same name in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/process/NodeCompleteNodeTranslationLookup.php \Drupal\migrate_drupal\Plugin\migrate\process\NodeCompleteNodeTranslationLookup::transform()
  2. 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/process/NodeCompleteNodeTranslationLookup.php \Drupal\migrate_drupal\Plugin\migrate\process\NodeCompleteNodeTranslationLookup::transform()
  3. 10 core/modules/migrate_drupal/src/Plugin/migrate/process/NodeCompleteNodeTranslationLookup.php \Drupal\migrate_drupal\Plugin\migrate\process\NodeCompleteNodeTranslationLookup::transform()

Overrides ProcessPluginBase::transform

File

core/modules/migrate_drupal/src/Plugin/migrate/process/NodeCompleteNodeTranslationLookup.php, line 29

Class

NodeCompleteNodeTranslationLookup
Returns nid and langcode from migration_lookup on node_complete migration.

Namespace

Drupal\migrate_drupal\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (is_array($value) && count($value) === 3) {
        // If the language is 'und' then the node was not translated.
        if ($value[2] === 'und') {
            return NULL;
        }
        unset($value[1]);
        return array_values($value);
    }
    return $value;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.