From 35458b5dfe556ccce9e8ae46b7dbeb63995933ae Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Tue, 8 Jul 2014 15:11:49 +0100 Subject: [PATCH] Issue #2260241 by ultimike, benjy, er.pushpinderrana: Fixed D6->D8 Profile field (date). --- ...igrate.migration.d6_user_profile_field.yml | 3 ++ .../process/d6/ProfileFieldSettings.php | 36 +++++++++++++++++++ .../Tests/d6/MigrateUserProfileFieldTest.php | 1 + 3 files changed, 40 insertions(+) create mode 100644 core/modules/migrate_drupal/src/Plugin/migrate/process/d6/ProfileFieldSettings.php diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml index 14103025de6c..eba5cb352dcd 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_user_profile_field.yml @@ -18,6 +18,9 @@ process: textfield: text textarea: text_long url: link + settings: + plugin: d6_profile_field_settings + source: type settings.allowed_values: options cardinality: plugin: static_map diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/ProfileFieldSettings.php b/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/ProfileFieldSettings.php new file mode 100644 index 000000000000..2ce2050e4d4d --- /dev/null +++ b/core/modules/migrate_drupal/src/Plugin/migrate/process/d6/ProfileFieldSettings.php @@ -0,0 +1,36 @@ +<?php + +/** + * @file + * Contains \Drupal\migrate_drupal\Plugin\migrate\Process\d6\ProfileFieldSettings. + */ + +namespace Drupal\migrate_drupal\Plugin\migrate\Process\d6; + +use Drupal\migrate\MigrateExecutable; +use Drupal\migrate\ProcessPluginBase; +use Drupal\migrate\Row; + +/** + * @MigrateProcessPlugin( + * id = "d6_profile_field_settings" + * ) + */ +class ProfileFieldSettings extends ProcessPluginBase { + + /** + * {@inheritdoc} + * + * Set the profile field settings configuration. + */ + public function transform($type, MigrateExecutable $migrate_executable, Row $row, $destination_property) { + $settings = array(); + switch ($type) { + case 'date': + $settings['datetime_type'] = 'date'; + break; + } + return $settings; + } + +} diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php index 71a1bcf99f5f..f41b91f0f37d 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserProfileFieldTest.php @@ -86,6 +86,7 @@ public function testUserProfileFields() { // Migrated date field. $field = entity_load('field_config', 'user.profile_birthdate'); $this->assertEqual($field->type, 'datetime', 'Field type is datetime.'); + $this->assertEqual($field->settings['datetime_type'], 'date'); } } -- GitLab