"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/user/src/Plugin/migrate/User.php" (26 Nov 2020, 1335 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "User.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\user\Plugin\migrate;
    4 
    5 use Drupal\migrate\Exception\RequirementsException;
    6 use Drupal\migrate_drupal\Plugin\migrate\FieldMigration;
    7 
    8 /**
    9  * Plugin class for Drupal 7 user migrations dealing with fields and profiles.
   10  */
   11 class User extends FieldMigration {
   12 
   13   /**
   14    * {@inheritdoc}
   15    */
   16   public function getProcess() {
   17     if (!$this->init) {
   18       $this->init = TRUE;
   19       $this->fieldDiscovery->addEntityFieldProcesses($this, 'user');
   20 
   21       $definition = [
   22         'source' => [
   23           'plugin' => 'profile_field',
   24           'ignore_map' => TRUE,
   25         ],
   26         'idMap' => [
   27           'plugin' => 'null',
   28         ],
   29         'destination' => [
   30           'plugin' => 'null',
   31         ],
   32       ];
   33       try {
   34         $profile_migration = $this->migrationPluginManager->createStubMigration($definition);
   35         // Ensure that Profile is enabled in the source DB.
   36         $profile_migration->checkRequirements();
   37         foreach ($profile_migration->getSourcePlugin() as $row) {
   38           $name = $row->getSourceProperty('name');
   39           $this->process[$name] = $name;
   40         }
   41       }
   42       catch (RequirementsException $e) {
   43         // The checkRequirements() call will fail when the profile module does
   44         // not exist on the source site.
   45       }
   46     }
   47     return parent::getProcess();
   48   }
   49 
   50 }