Commit e80f9052 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #2754493 by quietone, mikelutz, vacho, vasi, masipila: D6 synchronized...

Issue #2754493 by quietone, mikelutz, vacho, vasi, masipila: D6 synchronized field settings aren't migrated properly
parent 47dab9a4
......@@ -53,7 +53,7 @@ process:
source:
- widget_type
- widget_settings
translatable: translatable
destination:
plugin: entity:field_config
migration_dependencies:
......
......@@ -59,6 +59,17 @@ public function prepareRow(Row $row) {
$row->setSourceProperty('widget_settings', $widget_settings);
$row->setSourceProperty('display_settings', $display_settings);
$row->setSourceProperty('global_settings', $global_settings);
// Determine the translatable setting.
$translatable = TRUE;
$synchronized_fields = $this->variableGet('i18nsync_nodeapi_' . $row->getSourceProperty('type_name'), NULL);
if ($synchronized_fields) {
if (in_array($row->getSourceProperty('field_name'), $synchronized_fields)) {
$translatable = FALSE;
}
}
$row->setSourceProperty('translatable', $translatable);
return parent::prepareRow($row);
}
......
......@@ -161,6 +161,11 @@ public function testFieldInstanceMigration() {
$this->assertSame('user', $field->getSetting('target_type'));
$this->assertSame([], $field->getDefaultValueLiteral());
$this->assertTrue($field->isTranslatable());
// Test a synchronized field is not translatable.
$field = FieldConfig::load('node.employee.field_sync');
$this->assertInstanceOf(FieldConfig::class, $field);
$this->assertFalse($field->isTranslatable());
}
/**
......
......@@ -2802,6 +2802,18 @@
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_sync',
'type' => 'email',
'global_settings' => 'a:0:{}',
'required' => '0',
'multiple' => '0',
'db_storage' => '1',
'module' => 'email',
'db_columns' => 'a:1:{s:5:"email";a:4:{s:4:"type";s:7:"varchar";s:6:"length";i:255;s:8:"not null";b:0;s:8:"sortable";b:1;}}',
'active' => '1',
'locked' => '0',
))
->values(array(
'field_name' => 'field_test',
'type' => 'text',
......@@ -3219,6 +3231,18 @@
'widget_module' => 'nodereference',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_sync',
'type_name' => 'employee',
'weight' => '35',
'label' => 'email_sync',
'widget_type' => 'email_textfield',
'widget_settings' => 'a:3:{s:4:"size";s:2:"60";s:13:"default_value";a:1:{i:0;a:1:{s:5:"email";s:0:"";}}s:17:"default_value_php";N;}',
'display_settings' => 'a:7:{s:5:"label";a:2:{s:6:"format";s:5:"above";s:7:"exclude";i:0;}i:5;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:6:"teaser";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}s:4:"full";a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:4;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:2;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}i:3;a:2:{s:6:"format";s:7:"default";s:7:"exclude";i:0;}}',
'description' => '',
'widget_module' => 'email',
'widget_active' => '1',
))
->values(array(
'field_name' => 'field_test',
'type_name' => 'story',
......@@ -3530,6 +3554,11 @@
'size' => 'normal',
'unsigned' => TRUE,
),
'field_sync_email' => array(
'type' => 'varchar',
'not null' => FALSE,
'length' => '255',
),
),
'primary key' => array(
'vid',
......@@ -3558,6 +3587,7 @@
'field_commander_uid',
'field_company_2_nid',
'field_company_3_nid',
'field_sync_email',
))
->values(array(
'vid' => '21',
......@@ -3565,6 +3595,7 @@
'field_commander_uid' => '8',
'field_company_2_nid' => '15',
'field_company_3_nid' => '16',
'field_sync_email' => NULL,
))
->values(array(
'vid' => '2002',
......@@ -3572,6 +3603,7 @@
'field_commander_uid' => NULL,
'field_company_2_nid' => NULL,
'field_company_3_nid' => NULL,
'field_sync_email' => 'jsmith@example.com',
))
->values(array(
'vid' => '2003',
......@@ -3579,6 +3611,7 @@
'field_commander_uid' => NULL,
'field_company_2_nid' => NULL,
'field_company_3_nid' => NULL,
'field_sync_email' => 'jsmith@example.com',
))
->execute();
$connection->schema()->createTable('content_type_page', array(
......@@ -46764,11 +46797,11 @@
'name' => 'i18nsync',
'type' => 'module',
'owner' => '',
'status' => '0',
'status' => '1',
'throttle' => '0',
'bootstrap' => '0',
'schema_version' => '-1',
'weight' => '0',
'schema_version' => '0',
'weight' => '100',
'info' => 'a:10:{s:4:"name";s:24:"Synchronize translations";s:11:"description";s:74:"Synchronizes taxonomy and fields accross translations of the same content.";s:12:"dependencies";a:1:{i:0;s:4:"i18n";}s:7:"package";s:13:"Multilanguage";s:4:"core";s:3:"6.x";s:7:"version";s:7:"6.x-1.4";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1270669810";s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}',
))
->values(array(
......@@ -48226,7 +48259,7 @@
))
->values(array(
'name' => 'comment_controls_employee',
'value' => 'i:3;',
'value' => 's:1:"3";',
))
->values(array(
'name' => 'comment_controls_page',
......@@ -48266,7 +48299,7 @@
))
->values(array(
'name' => 'comment_default_mode_employee',
'value' => 'i:4;',
'value' => 's:1:"4";',
))
->values(array(
'name' => 'comment_default_mode_page',
......@@ -48306,7 +48339,7 @@
))
->values(array(
'name' => 'comment_default_order_employee',
'value' => 'i:1;',
'value' => 's:1:"1";',
))
->values(array(
'name' => 'comment_default_order_page',
......@@ -48346,7 +48379,7 @@
))
->values(array(
'name' => 'comment_default_per_page_employee',
'value' => 'i:50;',
'value' => 's:2:"50";',
))
->values(array(
'name' => 'comment_default_per_page_page',
......@@ -48376,6 +48409,10 @@
'name' => 'comment_default_per_page_test_story',
'value' => 'i:50;',
))
->values(array(
'name' => 'comment_employee',
'value' => 's:1:"2";',
))
->values(array(
'name' => 'comment_form_location_article',
'value' => 'i:0;',
......@@ -48386,7 +48423,7 @@
))
->values(array(
'name' => 'comment_form_location_employee',
'value' => 'i:0;',
'value' => 's:1:"0";',
))
->values(array(
'name' => 'comment_form_location_page',
......@@ -48430,7 +48467,7 @@
))
->values(array(
'name' => 'comment_preview_employee',
'value' => 'i:1;',
'value' => 's:1:"1";',
))
->values(array(
'name' => 'comment_preview_page',
......@@ -48474,7 +48511,7 @@
))
->values(array(
'name' => 'comment_subject_field_employee',
'value' => 'i:1;',
'value' => 's:1:"1";',
))
->values(array(
'name' => 'comment_subject_field_page',
......@@ -48840,6 +48877,10 @@
'name' => 'event_nodeapi_company',
'value' => 's:5:"never";',
))
->values(array(
'name' => 'event_nodeapi_employee',
'value' => 's:5:"never";',
))
->values(array(
'name' => 'event_nodeapi_event',
'value' => 's:3:"all";',
......@@ -48908,6 +48949,10 @@
'name' => 'form_build_id_company',
'value' => 's:48:"form-jFw2agRukPxjG5dG-N6joZLyoxXmCoxTzua0HUciqK0";',
))
->values(array(
'name' => 'form_build_id_employee',
'value' => 's:48:"form-q42bJnZxCCHxcx5FjxjEOd8OaEAg9wnK8nX1hBjtT4M";',
))
->values(array(
'name' => 'forum_block_num_0',
'value' => 's:1:"3";',
......@@ -48936,6 +48981,10 @@
'name' => 'i18nstrings_allowed_formats',
'value' => 'a:2:{i:0;i:1;i:1;i:2;}',
))
->values(array(
'name' => 'i18nsync_nodeapi_employee',
'value' => 'a:1:{i:0;s:10:"field_sync";}',
))
->values(array(
'name' => 'i18ntaxonomy_vocabulary',
'value' => 'a:4:{i:1;s:1:"3";i:2;s:1:"2";i:3;s:1:"3";i:5;s:1:"1";}',
......@@ -48944,6 +48993,22 @@
'name' => 'i18n_lock_node_article',
'value' => 'i:1;',
))
->values(array(
'name' => 'i18n_lock_node_employee',
'value' => 'i:0;',
))
->values(array(
'name' => 'i18n_newnode_current_employee',
'value' => 'i:0;',
))
->values(array(
'name' => 'i18n_node_employee',
'value' => 's:1:"1";',
))
->values(array(
'name' => 'i18n_required_node_employee',
'value' => 'i:0;',
))
->values(array(
'name' => 'image_jpeg_quality',
'value' => 'i:75;',
......@@ -49020,6 +49085,10 @@
'name' => 'node_options_company',
'value' => 'a:2:{i:0;s:6:"status";i:1;s:7:"promote";}',
))
->values(array(
'name' => 'node_options_employee',
'value' => 'a:2:{i:0;s:6:"status";i:1;s:7:"promote";}',
))
->values(array(
'name' => 'node_options_forum',
'value' => 'a:1:{i:0;s:6:"status";}',
......@@ -82,6 +82,7 @@ class ReviewForm extends MigrateUpgradeFormBase {
'filefield_meta',
'help',
'i18nstrings',
'i18nsync',
'imageapi',
'imageapi_gd',
'imageapi_imagemagick',
......
......@@ -115,6 +115,7 @@ protected function getAvailablePaths() {
'fieldgroup',
'filefield_meta',
'help',
'i18nsync',
'imageapi',
'imageapi_gd',
'imageapi_imagemagick',
......@@ -147,7 +148,6 @@ protected function getMissingPaths() {
'devel_node_access',
'i18ncontent',
'i18npoll',
'i18nsync',
'i18nviews',
'phone',
'views',
......
......@@ -106,6 +106,7 @@ protected function getAvailablePaths() {
'filefield_meta',
'help',
'i18nstrings',
'i18nsync',
'imageapi',
'imageapi_gd',
'imageapi_imagemagick',
......@@ -143,7 +144,6 @@ protected function getMissingPaths() {
'i18nmenu',
'i18npoll',
'i18nprofile',
'i18nsync',
'i18ntaxonomy',
'i18nviews',
'phone',
......
......@@ -68,8 +68,8 @@ protected function getEntityCounts() {
'contact_message' => 0,
'configurable_language' => 5,
'editor' => 2,
'field_config' => 91,
'field_storage_config' => 65,
'field_config' => 92,
'field_storage_config' => 66,
'file' => 7,
'filter_format' => 7,
'image_style' => 5,
......@@ -94,7 +94,7 @@ protected function getEntityCounts() {
'date_format' => 11,
'entity_form_display' => 29,
'entity_form_mode' => 1,
'entity_view_display' => 55,
'entity_view_display' => 57,
'entity_view_mode' => 14,
'base_field_override' => 38,
];
......@@ -107,7 +107,7 @@ protected function getEntityCountsIncremental() {
$counts = $this->getEntityCounts();
$counts['block_content'] = 3;
$counts['comment'] = 9;
$counts['entity_view_display'] = 55;
$counts['entity_view_display'] = 57;
$counts['entity_view_mode'] = 14;
$counts['file'] = 8;
$counts['menu_link_content'] = 11;
......
......@@ -207,6 +207,15 @@ public function testNode() {
]);
$node = Node::load(2);
$this->assertIdentical($title, $node->getTitle());
// Test synchronized field.
$value = 'jsmith@example.com';
$node = Node::load(21);
$this->assertSame($value, $node->field_sync->value);
$this->assertArrayNotHasKey('field_sync', $node->getTranslatableFields());
$node = $node->getTranslation('fr');
$this->assertSame($value, $node->field_sync->value);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment