Chris@0: ' . t('About') . ''; Chris@18: $output .= '
' . t('The Migrate Drupal module provides a framework based on the Migrate module to facilitate migration from a Drupal (6, 7, or 8) site to your website. It does not provide a user interface. For more information, see the online documentation for the Migrate Drupal module.', [':migrate' => Url::fromRoute('help.page', ['name' => 'migrate'])->toString(), ':migrate_drupal' => 'https://www.drupal.org/documentation/modules/migrate_drupal']) . '
'; Chris@0: return $output; Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_migration_plugins_alter(). Chris@0: */ Chris@0: function migrate_drupal_migration_plugins_alter(&$definitions) { Chris@0: // This is why the deriver can't do this: the 'd6_taxonomy_vocabulary' Chris@0: // definition is not available to the deriver as it is running inside Chris@0: // getDefinitions(). Chris@0: if (isset($definitions['d6_taxonomy_vocabulary'])) { Chris@0: $vocabulary_migration_definition = [ Chris@0: 'source' => [ Chris@0: 'ignore_map' => TRUE, Chris@0: 'plugin' => 'd6_taxonomy_vocabulary', Chris@0: ], Chris@0: 'destination' => [ Chris@0: 'plugin' => 'null', Chris@0: ], Chris@14: 'idMap' => [ Chris@14: 'plugin' => 'null', Chris@14: ], Chris@0: ]; Chris@0: $vocabulary_migration = \Drupal::service('plugin.manager.migration')->createStubMigration($vocabulary_migration_definition); Chris@0: Chris@0: try { Chris@0: $source_plugin = $vocabulary_migration->getSourcePlugin(); Chris@0: if ($source_plugin instanceof RequirementsInterface) { Chris@0: $source_plugin->checkRequirements(); Chris@0: } Chris@14: $executable = new MigrateExecutable($vocabulary_migration); Chris@0: $process = ['vid' => $definitions['d6_taxonomy_vocabulary']['process']['vid']]; Chris@0: foreach ($source_plugin as $row) { Chris@0: $executable->processRow($row, $process); Chris@0: $source_vid = $row->getSourceProperty('vid'); Chris@0: $plugin_ids = ['d6_term_node:' . $source_vid, 'd6_term_node_revision:' . $source_vid]; Chris@0: foreach ($plugin_ids as $plugin_id) { Chris@0: // Match the field name derivation in d6_vocabulary_field.yml. Chris@0: $field_name = substr('field_' . $row->getDestinationProperty('vid'), 0, 32); Chris@0: Chris@0: // The Forum module is expecting 'taxonomy_forums' as the field name Chris@0: // for the forum nodes. The 'forum_vocabulary' source property is Chris@0: // evaluated in Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary Chris@0: // and is set to true if the vocabulary vid being migrated is the Chris@0: // same as the one in the 'forum_nav_vocabulary' variable on the Chris@0: // source site. Chris@0: $destination_vid = $row->getSourceProperty('forum_vocabulary') ? 'taxonomy_forums' : $field_name; Chris@0: $definitions[$plugin_id]['process'][$destination_vid] = 'tid'; Chris@0: } Chris@0: } Chris@0: } Chris@0: catch (RequirementsException $e) { Chris@0: // This code currently runs whenever the definitions are being loaded and Chris@0: // if you have a Drupal 7 source site then the requirements will not be Chris@0: // met for the d6_taxonomy_vocabulary migration. Chris@0: } Chris@0: catch (DatabaseExceptionWrapper $e) { Chris@0: // When the definitions are loaded it is possible the tables will not Chris@0: // exist. Chris@0: } Chris@0: Chris@0: } Chris@0: }