You are here

protected function TermNode::getVocabularyIdMap in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Plugin/migrate/builder/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode::getVocabularyIdMap()

Builds a map of source vocabulary IDs to expected destination IDs.

Parameters

array $source: Additional configuration for the d6_taxonomy_vocabulary source.

Return value

array The vid map. The keys are the source IDs and the values are the (expected) destination IDs.

1 call to TermNode::getVocabularyIdMap()
TermNode::buildMigrations in core/modules/taxonomy/src/Plugin/migrate/builder/d6/TermNode.php
Builds migration entities based on a template.

File

core/modules/taxonomy/src/Plugin/migrate/builder/d6/TermNode.php, line 69
Contains \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode.

Class

TermNode
Plugin annotation @PluginID("d6_term_node");

Namespace

Drupal\taxonomy\Plugin\migrate\builder\d6

Code

protected function getVocabularyIdMap(array $source) {
  $map = [];
  $template = $this->templateStorage
    ->getTemplateByName('d6_taxonomy_vocabulary');
  $template['source'] += $source;
  $migration = Migration::create($template);
  $executable = new MigrateExecutable($migration, new MigrateMessage());

  // Only process the destination ID properties.
  $process = array_intersect_key($template['process'], $migration
    ->getDestinationPlugin()
    ->getIds());
  foreach ($migration
    ->getSourcePlugin() as $source_row) {

    // Process the row to generate the expected destination ID.
    $executable
      ->processRow($source_row, $process);
    $map[$source_row
      ->getSourceProperty('vid')] = $source_row
      ->getDestinationProperty('vid');
  }
  return $map;
}