User.php

Same filename in this branch
  1. 9 core/modules/user/src/Entity/User.php
  2. 9 core/modules/user/src/Plugin/views/argument_validator/User.php
  3. 9 core/modules/user/src/Plugin/views/argument_default/User.php
  4. 9 core/modules/user/src/Plugin/migrate/source/d6/User.php
  5. 9 core/modules/user/src/Plugin/migrate/source/d7/User.php
Same filename in other branches
  1. 8.9.x core/modules/user/src/Entity/User.php
  2. 8.9.x core/modules/user/src/Plugin/views/argument_validator/User.php
  3. 8.9.x core/modules/user/src/Plugin/views/argument_default/User.php
  4. 8.9.x core/modules/user/src/Plugin/migrate/source/d6/User.php
  5. 8.9.x core/modules/user/src/Plugin/migrate/source/d7/User.php
  6. 8.9.x core/modules/user/src/Plugin/migrate/User.php
  7. 10 core/modules/user/src/Entity/User.php
  8. 10 core/modules/user/src/Plugin/views/argument_validator/User.php
  9. 10 core/modules/user/src/Plugin/views/argument_default/User.php
  10. 10 core/modules/user/src/Plugin/migrate/source/d6/User.php
  11. 10 core/modules/user/src/Plugin/migrate/source/d7/User.php
  12. 10 core/modules/user/src/Plugin/migrate/User.php
  13. 11.x core/modules/user/src/Entity/User.php
  14. 11.x core/modules/user/src/Plugin/views/argument_validator/User.php
  15. 11.x core/modules/user/src/Plugin/views/argument_default/User.php
  16. 11.x core/modules/user/src/Plugin/migrate/source/d6/User.php
  17. 11.x core/modules/user/src/Plugin/migrate/source/d7/User.php
  18. 11.x core/modules/user/src/Plugin/migrate/User.php

Namespace

Drupal\user\Plugin\migrate

File

core/modules/user/src/Plugin/migrate/User.php

View source
<?php

namespace Drupal\user\Plugin\migrate;

use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate_drupal\Plugin\migrate\FieldMigration;

/**
 * Plugin class for Drupal 7 user migrations dealing with fields and profiles.
 */
class User extends FieldMigration {
    
    /**
     * {@inheritdoc}
     */
    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();
    }

}

Classes

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.