Mercurial > hg > isophonics-drupal-site
annotate core/modules/user/src/Plugin/migrate/ProfileValues.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | c2387f117808 |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\user\Plugin\migrate; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\migrate\Exception\RequirementsException; |
Chris@0 | 6 use Drupal\migrate\Plugin\Migration; |
Chris@0 | 7 |
Chris@0 | 8 /** |
Chris@0 | 9 * Plugin class for user migrations dealing with profile values. |
Chris@0 | 10 */ |
Chris@0 | 11 class ProfileValues extends Migration { |
Chris@0 | 12 |
Chris@0 | 13 /** |
Chris@0 | 14 * Flag determining whether the process plugin has been initialized. |
Chris@0 | 15 * |
Chris@0 | 16 * @var bool |
Chris@0 | 17 */ |
Chris@0 | 18 protected $init = FALSE; |
Chris@0 | 19 |
Chris@0 | 20 /** |
Chris@0 | 21 * {@inheritdoc} |
Chris@0 | 22 */ |
Chris@0 | 23 public function getProcess() { |
Chris@0 | 24 if (!$this->init) { |
Chris@0 | 25 $this->init = TRUE; |
Chris@0 | 26 $definition['source'] = [ |
Chris@0 | 27 'plugin' => 'profile_field', |
Chris@0 | 28 'ignore_map' => TRUE, |
Chris@0 | 29 ] + $this->source; |
Chris@0 | 30 $definition['destination']['plugin'] = 'null'; |
Chris@14 | 31 $definition['idMap']['plugin'] = 'null'; |
Chris@0 | 32 try { |
Chris@0 | 33 $profile_field_migration = $this->migrationPluginManager->createStubMigration($definition); |
Chris@0 | 34 $source_plugin = $profile_field_migration->getSourcePlugin(); |
Chris@0 | 35 $source_plugin->checkRequirements(); |
Chris@0 | 36 foreach ($source_plugin as $row) { |
Chris@0 | 37 $name = $row->getSourceProperty('name'); |
Chris@0 | 38 $this->process[$name] = $name; |
Chris@0 | 39 } |
Chris@0 | 40 } |
Chris@0 | 41 catch (RequirementsException $e) { |
Chris@0 | 42 // The checkRequirements() call will fail when the profile module does |
Chris@0 | 43 // not exist on the source site. |
Chris@0 | 44 } |
Chris@0 | 45 } |
Chris@0 | 46 return parent::getProcess(); |
Chris@0 | 47 } |
Chris@0 | 48 |
Chris@0 | 49 } |