diff --git a/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php b/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php index 5e7d9de..ae50524 100644 --- a/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php +++ b/core/modules/node/src/Plugin/migrate/D6NodeDeriver.php @@ -61,6 +61,13 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface { protected $includeTranslations; /** + * Whether or not to include terms. + * + * @var bool + */ + protected $includeTerms; + + /** * D6NodeDeriver constructor. * * @param string $base_plugin_id @@ -72,11 +79,12 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface { * @param bool $translations * Whether or not to include translations. */ - public function __construct($base_plugin_id, MigrateCckFieldPluginManagerInterface $cck_manager, MigrateFieldPluginManagerInterface $field_manager, $translations) { + public function __construct($base_plugin_id, MigrateCckFieldPluginManagerInterface $cck_manager, MigrateFieldPluginManagerInterface $field_manager, $translations, $terms) { $this->basePluginId = $base_plugin_id; $this->cckPluginManager = $cck_manager; $this->fieldPluginManager = $field_manager; $this->includeTranslations = $translations; + $this->includeTerms = $terms; } /** @@ -88,7 +96,8 @@ public static function create(ContainerInterface $container, $base_plugin_id) { $base_plugin_id, $container->get('plugin.manager.migrate.cckfield'), $container->get('plugin.manager.migrate.field'), - $container->get('module_handler')->moduleExists('content_translation') + $container->get('module_handler')->moduleExists('content_translation'), + $container->get('module_handler')->moduleExists('taxonomy') ); } @@ -135,7 +144,8 @@ public function getDerivativeDefinitions($base_plugin_definition) { // below we'll create a migration just for the node properties. } - try { + // If the taxonomy module does not exist, then we do not have any terms. + if ($this->includeTerms) { $source_plugin = static::getSourcePlugin('d6_vocabulary_field_instance'); $source_plugin->checkRequirements(); @@ -143,10 +153,6 @@ public function getDerivativeDefinitions($base_plugin_definition) { $fields[$row->getSourceProperty('bundle')][$row->getSourceProperty('field_name')] = $row->getSourceProperty('field_name'); } } - catch (RequirementsException $e) { - // If checkRequirements() failed then the taxonomy module did not exist - // and we do not have any term fields. - } try { foreach ($node_types as $row) {