diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml index 4c56d6810911ca737bb07054f906860ada592bc4..609f391f3a386650bc7d5719f7205026ac100505 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_node_type.yml @@ -14,9 +14,9 @@ process: description: description help: help title_label: title_label - preview: 'constants/preview' - submitted: submitted - options: options + 'settings/node/preview': 'constants/preview' + 'settings/node/submitted': submitted + 'settings/node/options': options create_body: has_body create_body_label: body_label destination: diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php index 592f8b8091f496fab15761e60c092da9a4b7c0df..665cc1398f5f41ebf6cc1a6dbaae8a4e6601db46 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/NodeType.php @@ -103,9 +103,10 @@ public function prepareRow(Row $row) { $row->setSourceProperty('node_preview', $this->nodePreview); $type = $row->getSourceProperty('type'); - $options = $this->variableGet('node_options_' . $type, array('promote', 'sticky')); + $source_options = $this->variableGet('node_options_' . $type, array('promote', 'sticky')); + $options = array(); foreach (array('promote', 'sticky', 'status', 'revision') as $item) { - $options[$item] = isset($options[$item]); + $options[$item] = in_array($item, $source_options); } $row->setSourceProperty('options', $options); $submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE; diff --git a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6NodeType.php b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6NodeType.php index 59736b32f69679a580eb9b2991f37482965212a2..c6e9baf74f92e6d0466930869877cfafb642a3c9 100644 --- a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6NodeType.php +++ b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6NodeType.php @@ -65,6 +65,22 @@ public function load() { 'locked' => 0, 'orig_type' => 'story', )) + ->values(array( + 'type' => 'test_event', + 'name' => 'Migrate test event', + 'module' => 'node', + 'description' => "test event description here", + 'help' => 'help text here', + 'has_title' => 1, + 'title_label' => 'Event Name', + 'has_body' => 1, + 'body_label' => 'Body', + 'min_word_count' => 0, + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + 'orig_type' => 'event', + )) ->execute(); $this->database->merge('node_type') @@ -92,7 +108,7 @@ public function load() { 'value', )) ->values(array( - 'name' => 'node_options_migrate_test_page', + 'name' => 'node_options_test_page', 'value' => serialize(array( 0 => 'status', 1 => 'promote', @@ -100,12 +116,19 @@ public function load() { )), )) ->values(array( - 'name' => 'node_options_migrate_test_story', + 'name' => 'node_options_test_story', 'value' => serialize(array( 0 => 'status', 1 => 'promote', )), )) + ->values(array( + 'name' => 'node_options_test_event', + 'value' => serialize(array( + 0 => 'sticky', + 1 => 'revision', + )), + )) ->values(array( 'name' => 'theme_settings', 'value' => serialize(array( @@ -127,8 +150,9 @@ public function load() { 'default_favicon' => 1, 'favicon_path' => '', 'favicon_upload' => '', - 'toggle_node_info_migrate_test_page' => 1, - 'toggle_node_info_migrate_test_story' => 1, + 'toggle_node_info_test_page' => 1, + 'toggle_node_info_test_story' => 1, + 'toggle_node_info_test_event' => 1, )), )) ->execute(); diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php index 094ca3d7199f7fd6b54725d51af9ba9e4bff7543..b497e875b9ee5733f5befda28e8f8f7f2123e3dc 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTypeTest.php @@ -51,7 +51,7 @@ public function testNodeType() { 'options' => array( 'status' => TRUE, 'promote' => TRUE, - 'sticky' => FALSE, + 'sticky' => TRUE, 'revision' => FALSE, ), 'preview' => 1, @@ -78,11 +78,32 @@ public function testNodeType() { 'preview' => 1, 'submitted' => TRUE, ); - $this->assertEqual($node_type_page->settings['node'], $expected, 'Node type test_page settings correct.'); + $this->assertEqual($node_type_story->settings['node'], $expected, 'Node type test_story settings correct.'); $this->assertEqual(array('test_story'), $migration->getIdMap()->lookupDestinationID(array('test_story'))); // Test we don't have a body field. $instance = FieldInstanceConfig::loadByName('node', 'test_story', 'body'); $this->assertEqual($instance, NULL, 'No body field found'); + + // Test the test_event content type. + $node_type_event = entity_load('node_type', 'test_event'); + $this->assertEqual($node_type_event->id(), 'test_event', 'Node type test_event loaded'); + $expected = array( + 'options' => array( + 'status' => FALSE, + 'promote' => FALSE, + 'sticky' => TRUE, + 'revision' => TRUE, + ), + 'preview' => 1, + 'submitted' => TRUE, + ); + + $this->assertEqual($node_type_event->settings['node'], $expected, 'Node type test_event settings correct.'); + $this->assertEqual(array('test_event'), $migration->getIdMap()->lookupDestinationID(array('test_event'))); + + // Test we have a body field. + $instance = FieldInstanceConfig::loadByName('node', 'test_event', 'body'); + $this->assertEqual($instance->getLabel(), 'Body', 'Body field was found.'); } }