ProfileValues.php in Drupal 10
File
core/modules/user/src/Plugin/migrate/ProfileValues.php
View source
<?php
namespace Drupal\user\Plugin\migrate;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\Plugin\Migration;
class ProfileValues extends Migration {
protected $init = FALSE;
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');
$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])) {
$this->process[$new_value[1]] = $name;
}
}
} catch (RequirementsException $e) {
}
}
return parent::getProcess();
}
}
Classes
Name |
Description |
ProfileValues |
Plugin class for user migrations dealing with profile values. |