diff --git a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php index 5017a3e..2ec74dd 100644 --- a/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php +++ b/core/modules/menu/lib/Drupal/menu/Tests/MenuTest.php @@ -344,6 +344,16 @@ function testMenuBundles() { $menus[$menu->id()] = $menu->label(); ksort($menus); $this->assertIdentical(array_keys($bundles), array_keys($menus)); + + // Test if moving a menu link between menus changes the bundle. + $node = $this->drupalCreateNode(array('type' => 'article')); + $item = $this->addMenuLink(0, 'node/' . $node->nid, 'tools'); + $this->moveMenuLink($item, 0, $menu->id()); + $this->assertEqual($item->bundle(), 'tools', 'Menu link bundle matches the menue'); + + $moved_item = entity_load('menu_link', $item->id(), TRUE); + $this->assertNotEqual($moved_item->bundle(), $item->bundle(), 'Menu link bundle was changed'); + $this->assertEqual($moved_item->bundle(), $menu->id(), 'Menu link bundle matches the menue'); } /** diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php index af4c799..705e983 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php @@ -35,7 +35,11 @@ * entity_keys = { * "id" = "mlid", * "label" = "link_title", - * "uuid" = "uuid" + * "uuid" = "uuid", + * "bundle" = "menu_name", + * }, + * bundle_keys = { + * "bundle" = "menu_name" * } * ) */ @@ -254,6 +258,13 @@ public function id() { } /** + * {@inheritdoc} + */ + public function bundle() { + return $this->menu_name; + } + + /** * Overrides Entity::createDuplicate(). */ public function createDuplicate() {