comparison core/modules/user/src/Plugin/migrate/User.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
14 * {@inheritdoc} 14 * {@inheritdoc}
15 */ 15 */
16 public function getProcess() { 16 public function getProcess() {
17 if (!$this->init) { 17 if (!$this->init) {
18 $this->init = TRUE; 18 $this->init = TRUE;
19 $definition['source'] = [ 19 $this->fieldDiscovery->addEntityFieldProcesses($this, 'user');
20 'entity_type' => 'user', 20
21 'ignore_map' => TRUE, 21 $definition = [
22 ] + $this->source; 22 'source' => [
23 $definition['destination']['plugin'] = 'null'; 23 'plugin' => 'profile_field',
24 $definition['idMap']['plugin'] = 'null'; 24 'ignore_map' => TRUE,
25 if (\Drupal::moduleHandler()->moduleExists('field')) { 25 ],
26 $definition['source']['plugin'] = 'd7_field_instance'; 26 'idMap' => [
27 $field_migration = $this->migrationPluginManager->createStubMigration($definition); 27 'plugin' => 'null',
28 foreach ($field_migration->getSourcePlugin() as $row) { 28 ],
29 $field_name = $row->getSourceProperty('field_name'); 29 'destination' => [
30 $field_type = $row->getSourceProperty('type'); 30 'plugin' => 'null',
31 if (empty($field_type)) { 31 ],
32 continue; 32 ];
33 }
34 if ($this->fieldPluginManager->hasDefinition($field_type)) {
35 if (!isset($this->fieldPluginCache[$field_type])) {
36 $this->fieldPluginCache[$field_type] = $this->fieldPluginManager->createInstance($field_type, [], $this);
37 }
38 $info = $row->getSource();
39 $this->fieldPluginCache[$field_type]
40 ->defineValueProcessPipeline($this, $field_name, $info);
41 }
42 else {
43 if ($this->cckPluginManager->hasDefinition($field_type)) {
44 if (!isset($this->cckPluginCache[$field_type])) {
45 $this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $this);
46 }
47 $info = $row->getSource();
48 $this->cckPluginCache[$field_type]
49 ->processCckFieldValues($this, $field_name, $info);
50 }
51 else {
52 $this->process[$field_name] = $field_name;
53 }
54 }
55 }
56 }
57 try { 33 try {
58 $definition['source']['plugin'] = 'profile_field';
59 $profile_migration = $this->migrationPluginManager->createStubMigration($definition); 34 $profile_migration = $this->migrationPluginManager->createStubMigration($definition);
60 // Ensure that Profile is enabled in the source DB. 35 // Ensure that Profile is enabled in the source DB.
61 $profile_migration->checkRequirements(); 36 $profile_migration->checkRequirements();
62 foreach ($profile_migration->getSourcePlugin() as $row) { 37 foreach ($profile_migration->getSourcePlugin() as $row) {
63 $name = $row->getSourceProperty('name'); 38 $name = $row->getSourceProperty('name');