comparison core/modules/user/src/Plugin/migrate/ProfileValues.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\user\Plugin\migrate;
4
5 use Drupal\migrate\Exception\RequirementsException;
6 use Drupal\migrate\Plugin\Migration;
7
8 /**
9 * Plugin class for user migrations dealing with profile values.
10 */
11 class ProfileValues extends Migration {
12
13 /**
14 * Flag determining whether the process plugin has been initialized.
15 *
16 * @var bool
17 */
18 protected $init = FALSE;
19
20 /**
21 * {@inheritdoc}
22 */
23 public function getProcess() {
24 if (!$this->init) {
25 $this->init = TRUE;
26 $definition['source'] = [
27 'plugin' => 'profile_field',
28 'ignore_map' => TRUE,
29 ] + $this->source;
30 $definition['destination']['plugin'] = 'null';
31 try {
32 $profile_field_migration = $this->migrationPluginManager->createStubMigration($definition);
33 $source_plugin = $profile_field_migration->getSourcePlugin();
34 $source_plugin->checkRequirements();
35 foreach ($source_plugin as $row) {
36 $name = $row->getSourceProperty('name');
37 $this->process[$name] = $name;
38 }
39 }
40 catch (RequirementsException $e) {
41 // The checkRequirements() call will fail when the profile module does
42 // not exist on the source site.
43 }
44 }
45 return parent::getProcess();
46 }
47
48 }