Commit 5875eb52 authored by catch's avatar catch

Issue #2333985 by quietone, jarsenx, ultimike, heddn: Migrate menu_default_node_menu setting

parent 8938ab29
......@@ -15,7 +15,7 @@ class MigrateBookTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['book'];
public static $modules = ['book', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -17,7 +17,7 @@ class MigrateCommentTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment'];
public static $modules = ['comment', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -11,6 +11,11 @@
*/
class MigrateCommentVariableEntityDisplayTest extends MigrateCommentVariableDisplayBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -11,6 +11,11 @@
*/
class MigrateCommentVariableEntityFormDisplayTest extends MigrateCommentVariableDisplayBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -15,7 +15,7 @@ class MigrateCommentVariableFieldTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment'];
public static $modules = ['comment', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -16,7 +16,7 @@ class MigrateCommentVariableInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['comment'];
public static $modules = ['comment', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -12,7 +12,7 @@
*/
class MigrateCommentEntityDisplayTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -12,7 +12,7 @@
*/
class MigrateCommentEntityFormDisplaySubjectTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -12,7 +12,7 @@
*/
class MigrateCommentEntityFormDisplayTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@
*/
class MigrateCommentFieldInstanceTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -14,7 +14,7 @@
*/
class MigrateCommentFieldTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -14,7 +14,7 @@
*/
class MigrateCommentTest extends MigrateDrupal7TestBase {
public static $modules = ['filter', 'node', 'comment', 'text'];
public static $modules = ['filter', 'node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -13,7 +13,7 @@
*/
class MigrateCommentTypeTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'comment', 'text'];
public static $modules = ['node', 'comment', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -12,6 +12,11 @@
*/
class MigrateFieldFormatterSettingsTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -14,6 +14,11 @@
*/
class MigrateFieldInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* Tests migration of file variables to file.settings.yml.
*/
......
......@@ -12,6 +12,11 @@
*/
class MigrateFieldWidgetSettingsTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -29,6 +29,7 @@ class MigrateFieldInstanceWidgetSettingsTest extends MigrateDrupal7TestBase {
'taxonomy',
'telephone',
'text',
'menu_ui',
];
/**
......
......@@ -12,6 +12,11 @@
*/
class MigrateUploadEntityDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -12,6 +12,11 @@
*/
class MigrateUploadEntityFormDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -12,6 +12,11 @@
*/
class MigrateUploadFieldTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -12,6 +12,11 @@
*/
class MigrateUploadInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -13,6 +13,11 @@
*/
class MigrateUploadTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -16,7 +16,7 @@ class MigrateLanguageContentSettingsTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['node', 'text', 'language', 'content_translation'];
public static $modules = ['node', 'text', 'language', 'content_translation', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -16,7 +16,7 @@ class MigrateLanguageContentSettingsTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['node', 'text', 'language', 'content_translation'];
public static $modules = ['node', 'text', 'language', 'content_translation', 'menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -46081,6 +46081,10 @@
'name',
'value',
))
->values(array(
'name' => 'menu_default_node_menu',
'value' => 's:10:"navigation";',
))
->values(array(
'name' => 'actions_max_stack',
'value' => 'i:35;',
......@@ -20,5 +20,7 @@ process:
'settings/node/options': options
create_body: has_body
create_body_label: body_label
'third_party_settings/menu_ui/available_menus': available_menus
'third_party_settings/menu_ui/parent': parent
destination:
plugin: entity:node_type
......@@ -17,5 +17,7 @@ process:
new_revision: 'options/revision'
create_body: create_body
create_body_label: body_label
'third_party_settings/menu_ui/available_menus': available_menus
'third_party_settings/menu_ui/parent': parent
destination:
plugin: entity:node_type
......@@ -107,6 +107,10 @@ public function prepareRow(Row $row) {
$submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE;
$row->setSourceProperty('display_submitted', $submitted);
if ($default_node_menu = $this->variableGet('menu_default_node_menu', NULL)) {
$row->setSourceProperty('available_menus', [$default_node_menu]);
$row->setSourceProperty('parent', $default_node_menu . ':');
}
return parent::prepareRow($row);
}
......
......@@ -101,6 +101,12 @@ public function prepareRow(Row $row) {
$row->setSourceProperty('display_submitted', $this->variableGet('node_submitted_' . $type, TRUE));
if ($menu_options = $this->variableGet('menu_options_' . $type, NULL)) {
$row->setSourceProperty('available_menus', $menu_options);
}
if ($parent = $this->variableGet('menu_parent_' . $type, NULL)) {
$row->setSourceProperty('parent', $parent . ':');
}
return parent::prepareRow($row);
}
......
......@@ -13,7 +13,7 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'content_translation'];
public static $modules = ['language', 'content_translation', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -13,6 +13,11 @@
*/
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......
......@@ -10,7 +10,7 @@
*/
class MigrateNodeSettingPromoteTest extends MigrateDrupal6TestBase {
public static $modules = ['node', 'text'];
public static $modules = ['node', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -10,7 +10,7 @@
*/
class MigrateNodeSettingStatusTest extends MigrateDrupal6TestBase {
public static $modules = ['node', 'text'];
public static $modules = ['node', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -10,7 +10,7 @@
*/
class MigrateNodeSettingStickyTest extends MigrateDrupal6TestBase {
public static $modules = ['node', 'text'];
public static $modules = ['node', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -19,7 +19,7 @@ class MigrateNodeTest extends MigrateNodeTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'content_translation'];
public static $modules = ['language', 'content_translation', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -13,6 +13,11 @@
*/
class MigrateNodeTypeTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
......@@ -39,6 +44,12 @@ public function testNodeType() {
$field = FieldConfig::loadByName('node', 'test_page', 'body');
$this->assertIdentical('This is the body field label', $field->getLabel(), 'Body field was found.');
// Test default menus.
$expected_available_menus = ['navigation'];
$this->assertSame($expected_available_menus, $node_type_page->getThirdPartySetting('menu_ui', 'available_menus'));
$expected_parent = 'navigation:';
$this->assertSame($expected_parent, $node_type_page->getThirdPartySetting('menu_ui', 'parent'));
// Test the test_story content type.
$node_type_story = NodeType::load('test_story');
$this->assertIdentical('test_story', $node_type_story->id(), 'Node type test_story loaded');
......@@ -52,6 +63,12 @@ public function testNodeType() {
$field = FieldConfig::loadByName('node', 'test_story', 'body');
$this->assertIdentical(NULL, $field, 'No body field found');
// Test default menus.
$expected_available_menus = ['navigation'];
$this->assertSame($expected_available_menus, $node_type_story->getThirdPartySetting('menu_ui', 'available_menus'));
$expected_parent = 'navigation:';
$this->assertSame($expected_parent, $node_type_story->getThirdPartySetting('menu_ui', 'parent'));
// Test the test_event content type.
$node_type_event = NodeType::load('test_event');
$this->assertIdentical('test_event', $node_type_event->id(), 'Node type test_event loaded');
......@@ -64,6 +81,11 @@ public function testNodeType() {
// Test we have a body field.
$field = FieldConfig::loadByName('node', 'test_event', 'body');
$this->assertIdentical('Body', $field->getLabel(), 'Body field was found.');
$expected_available_menus = ['navigation'];
$this->assertSame($expected_available_menus, $node_type_event->getThirdPartySetting('menu_ui', 'available_menus'));
$expected_parent = 'navigation:';
$this->assertSame($expected_parent, $node_type_event->getThirdPartySetting('menu_ui', 'parent'));
}
}
......@@ -24,6 +24,7 @@ class MigrateNodeTest extends MigrateDrupal7TestBase {
'image',
'language',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',
......
......@@ -12,7 +12,7 @@
*/
class MigrateNodeTitleLabelTest extends MigrateDrupal7TestBase {
public static $modules = ['node', 'text'];
public static $modules = ['node', 'text', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -20,7 +20,7 @@ class MigrateNodeTypeTest extends MigrateDrupal7TestBase {
*
* @var array
*/
public static $modules = ['node', 'text', 'filter'];
public static $modules = ['node', 'text', 'filter', 'menu_ui'];
/**
* {@inheritdoc}
......@@ -45,12 +45,13 @@ protected function setUp() {
* @param string $help
* The expected help text.
*/
protected function assertEntity($id, $label, $description, $help, $display_submitted, $new_revision, $body_label = NULL) {
protected function assertEntity($id, $label, $description, $help, $display_submitted, $new_revision, $expected_available_menus, $expected_parent, $body_label = NULL) {
/** @var \Drupal\node\NodeTypeInterface $entity */
$entity = NodeType::load($id);
$this->assertTrue($entity instanceof NodeTypeInterface);
$this->assertIdentical($label, $entity->label());
$this->assertIdentical($description, $entity->getDescription());
$this->assertIdentical($help, $entity->getHelp());
$this->assertIdentical($display_submitted, $entity->displaySubmitted(), 'Submission info is displayed');
......@@ -62,20 +63,32 @@ protected function assertEntity($id, $label, $description, $help, $display_submi
$this->assertTrue($body instanceof FieldConfigInterface);
$this->assertIdentical($body_label, $body->label());
}
$this->assertSame($expected_available_menus, $entity->getThirdPartySetting('menu_ui', 'available_menus'));
$this->assertSame($expected_parent, $entity->getThirdPartySetting('menu_ui', 'parent'));
}
/**
* Tests Drupal 7 node type to Drupal 8 migration.
*/
public function testNodeType() {
$this->assertEntity('article', 'Article', 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.', 'Help text for articles', TRUE, FALSE, "Body");
$this->assertEntity('blog', 'Blog entry', 'Use for multi-user blogs. Every user gets a personal blog.', 'Blog away, good sir!', TRUE, FALSE, 'Body');
$expected_available_menus = ['main-menu'];
$expected_parent = 'main-menu:0:';
$this->assertEntity('article', 'Article', 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.', 'Help text for articles', TRUE, FALSE, $expected_available_menus, $expected_parent, "Body");
$this->assertEntity('blog', 'Blog entry', 'Use for multi-user blogs. Every user gets a personal blog.', 'Blog away, good sir!', TRUE, FALSE, $expected_available_menus, $expected_parent, 'Body');
// book's display_submitted flag is not set, so it will default to TRUE.
$this->assertEntity('book', 'Book page', '<em>Books</em> have a built-in hierarchical navigation. Use for handbooks or tutorials.', '', TRUE, TRUE, "Body");
$this->assertEntity('forum', 'Forum topic', 'A <em>forum topic</em> starts a new discussion thread within a forum.', 'No name-calling, no flame wars. Be nice.', TRUE, FALSE, 'Body');
$this->assertEntity('page', 'Basic page', "Use <em>basic pages</em> for your static content, such as an 'About us' page.", 'Help text for basic pages', FALSE, FALSE, "Body");
$this->assertEntity('book', 'Book page', '<em>Books</em> have a built-in hierarchical navigation. Use for handbooks or tutorials.', '', TRUE, TRUE, $expected_available_menus, $expected_parent, "Body");
$this->assertEntity('forum', 'Forum topic', 'A <em>forum topic</em> starts a new discussion thread within a forum.', 'No name-calling, no flame wars. Be nice.', TRUE, FALSE, $expected_available_menus, $expected_parent, 'Body');
$this->assertEntity('page', 'Basic page', "Use <em>basic pages</em> for your static content, such as an 'About us' page.", 'Help text for basic pages', FALSE, FALSE, $expected_available_menus, $expected_parent, "Body");
// This node type does not carry a body field.
$this->assertEntity('test_content_type', 'Test content type', 'This is the description of the test content type.', 'Help text for test content type', FALSE, TRUE);
$expected_available_menus = [
'main-menu',
'management',
'navigation',
'user-menu',
];
$this->assertEntity('test_content_type', 'Test content type', 'This is the description of the test content type.', 'Help text for test content type', FALSE, TRUE, $expected_available_menus, $expected_parent);
}
}
......@@ -16,7 +16,7 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'content_translation', 'path'];
public static $modules = ['language', 'content_translation', 'path', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -17,6 +17,7 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
public static $modules = [
'content_translation',
'language',
'menu_ui',
'node',
'path',
'text',
......
......@@ -14,7 +14,7 @@ class MigrateTermNodeRevisionTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class MigrateTermNodeTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class MigrateVocabularyEntityDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['field', 'taxonomy'];
public static $modules = ['field', 'taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class MigrateVocabularyEntityFormDisplayTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class MigrateVocabularyFieldInstanceTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -15,7 +15,7 @@ class MigrateVocabularyFieldTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy'];
public static $modules = ['taxonomy', 'menu_ui'];
/**
* {@inheritdoc}
......
......@@ -20,6 +20,7 @@ class MigrateNodeTaxonomyTest extends MigrateDrupal7TestBase {
'filter',
'image',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',
......
......@@ -18,6 +18,7 @@ class MigrateTaxonomyTermTest extends MigrateDrupal7TestBase {
'datetime',
'image',
'link',
'menu_ui',
'node',
'taxonomy',
'telephone',
......
......@@ -16,6 +16,7 @@ class MigrateTrackerNodeTest extends MigrateDrupal7TestBase {
* {@inheritdoc}
*/
public static $modules = [
'menu_ui',
'node',
'text',
'tracker',
......
......@@ -16,6 +16,7 @@ class MigrateTrackerUserTest extends MigrateDrupal7TestBase {
* {@inheritdoc}
*/
public static $modules = [
'menu_ui',
'node',
'text',
'tracker',
......
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