/** * {@inheritdoc} */ public function getProcess() { if (!$this->init) { $this->init = TRUE; $definition['source'] = ['entity_type' => 'user', 'ignore_map' => TRUE] + $this->source; $definition['destination']['plugin'] = 'null'; if (\Drupal::moduleHandler()->moduleExists('field')) { $definition['source']['plugin'] = 'd7_field_instance'; $field_migration = new Migration([], uniqid(), $definition); foreach ($field_migration->getSourcePlugin() as $row) { $field_name = $row->getSourceProperty('field_name'); $this->process[$field_name] = $field_name; } } try { $definition['source']['plugin'] = 'profile_field'; $profile_migration = new Migration([], uniqid(), $definition); // Ensure that Profile is enabled in the source DB. $profile_migration->checkRequirements(); foreach ($profile_migration->getSourcePlugin() as $row) { $name = $row->getSourceProperty('name'); $this->process[$name] = $name; } } catch (RequirementsException $e) { // The checkRequirements() call will fail when the profile module does // not exist on the source site. } } return parent::getProcess(); }
/** * {@inheritdoc} */ public function getProcess() { if (!$this->init) { $this->init = TRUE; $definition['source'] = ['plugin' => 'profile_field', 'ignore_map' => TRUE] + $this->source; $definition['destination']['plugin'] = 'null'; try { $profile_field_migration = $this->migrationPluginManager->createStubMigration($definition); $source_plugin = $profile_field_migration->getSourcePlugin(); $source_plugin->checkRequirements(); foreach ($source_plugin as $row) { $name = $row->getSourceProperty('name'); $this->process[$name] = $name; } } catch (RequirementsException $e) { // The checkRequirements() call will fail when the profile module does // not exist on the source site. } } return parent::getProcess(); }
/** * {@inheritdoc} */ public function getProcess() { if (!$this->init) { $this->init = TRUE; $source_plugin = $this->migrationPluginManager->createInstance($this->pluginId)->getSourcePlugin(); if ($source_plugin instanceof RequirementsInterface) { try { $source_plugin->checkRequirements(); } catch (RequirementsException $e) { // Kill the rest of the method. $source_plugin = []; } } foreach ($source_plugin as $row) { $field_type = $row->getSourceProperty('type'); if (!isset($this->processedFieldTypes[$field_type]) && $this->cckPluginManager->hasDefinition($field_type)) { $this->processedFieldTypes[$field_type] = TRUE; // Allow the cckfield plugin to alter the migration as necessary so // that it knows how to handle fields of this type. if (!isset($this->cckPluginCache[$field_type])) { $this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this); } call_user_func([$this->cckPluginCache[$field_type], $this->pluginDefinition['cck_plugin_method']], $this); } } } return parent::getProcess(); }