You are here

public function User::getProcess in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/migrate/User.php \Drupal\user\Plugin\migrate\User::getProcess()

Get the normalized process pipeline configuration describing the process plugins.

The process configuration is always normalized. All shorthand processing will be expanded into their full representations.

Return value

array The normalized configuration describing the process plugins.

Overrides FieldMigration::getProcess

See also

https://www.drupal.org/node/2129651#get-shorthand

File

core/modules/user/src/Plugin/migrate/User.php, line 16

Class

User
Plugin class for Drupal 7 user migrations dealing with fields and profiles.

Namespace

Drupal\user\Plugin\migrate

Code

public function getProcess() {
  if (!$this->init) {
    $this->init = TRUE;
    $this->fieldDiscovery
      ->addEntityFieldProcesses($this, 'user');
    $definition = [
      'source' => [
        'plugin' => 'profile_field',
        'ignore_map' => TRUE,
      ],
      'idMap' => [
        'plugin' => 'null',
      ],
      'destination' => [
        'plugin' => 'null',
      ],
    ];
    try {
      $profile_migration = $this->migrationPluginManager
        ->createStubMigration($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();
}