class ProfileValues in Drupal 10
Same name and namespace in other branches
- 8 core/modules/user/src/Plugin/migrate/ProfileValues.php \Drupal\user\Plugin\migrate\ProfileValues
- 9 core/modules/user/src/Plugin/migrate/ProfileValues.php \Drupal\user\Plugin\migrate\ProfileValues
Plugin class for user migrations dealing with profile values.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\migrate\Plugin\Migration implements ContainerFactoryPluginInterface, MigrationInterface, RequirementsInterface
- class \Drupal\user\Plugin\migrate\ProfileValues
- class \Drupal\migrate\Plugin\Migration implements ContainerFactoryPluginInterface, MigrationInterface, RequirementsInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ProfileValues
1 string reference to 'ProfileValues'
- d6_profile_values.yml in core/
modules/ user/ migrations/ d6_profile_values.yml - core/modules/user/migrations/d6_profile_values.yml
File
- core/
modules/ user/ src/ Plugin/ migrate/ ProfileValues.php, line 12
Namespace
Drupal\user\Plugin\migrateView source
class ProfileValues extends Migration {
/**
* Flag determining whether the process plugin has been initialized.
*
* @var bool
*/
protected $init = FALSE;
/**
* {@inheritdoc}
*/
public function getProcess() {
if (!$this->init) {
$this->init = TRUE;
$definition['source'] = [
'plugin' => 'profile_field',
'ignore_map' => TRUE,
] + $this->source;
$definition['destination']['plugin'] = 'null';
$definition['idMap']['plugin'] = 'null';
try {
$this
->checkRequirements();
$profile_field_migration = $this->migrationPluginManager
->createStubMigration($definition);
$migrate_executable = new MigrateExecutable($profile_field_migration);
$source_plugin = $profile_field_migration
->getSourcePlugin();
$source_plugin
->checkRequirements();
foreach ($source_plugin as $row) {
$name = $row
->getSourceProperty('name');
$fid = $row
->getSourceProperty('fid');
// The user profile field name can be greater than 32 characters. Use
// the migrated profile field name in the process pipeline.
$configuration = [
'migration' => 'user_profile_field',
'source_ids' => $fid,
'no_stub' => TRUE,
];
$plugin = $this->processPluginManager
->createInstance('migration_lookup', $configuration, $profile_field_migration);
$new_value = $plugin
->transform($fid, $migrate_executable, $row, 'tmp');
if (isset($new_value[1])) {
// Set the destination to the migrated profile field name.
$this->process[$new_value[1]] = $name;
}
}
} catch (RequirementsException $e) {
// The checkRequirements() call will fail when the profile module does
// not exist on the source site, or if the required migrations have not
// yet run.
}
}
return parent::getProcess();
}
}