diff --git a/core/modules/menu_link_content/menu_link_content.install b/core/modules/menu_link_content/menu_link_content.install index 606ca6a..adaf6dd 100644 --- a/core/modules/menu_link_content/menu_link_content.install +++ b/core/modules/menu_link_content/menu_link_content.install @@ -11,9 +11,10 @@ function menu_link_content_uninstall() { // Call the manager and delete all the plugins. $uuids = db_query('SELECT uuid FROM {menu_link_content}')->fetchCol(); - $menu_tree = \Drupal::menuTree(); + /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */ + $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); foreach ($uuids as $uuid) { // Manually build the plugin ID, and remove it from the menu tree. - $menu_tree->deleteLink("menu_link_content:$uuid", FALSE); + $menu_link_manager->removeDefinition("menu_link_content:$uuid", FALSE); } } diff --git a/core/modules/menu_ui/menu_ui.routing.yml b/core/modules/menu_ui/menu_ui.routing.yml index 319d922..b095c34 100644 --- a/core/modules/menu_ui/menu_ui.routing.yml +++ b/core/modules/menu_ui/menu_ui.routing.yml @@ -44,7 +44,7 @@ menu_ui.link_reset: type: menu_link_plugin requirements: _permission: 'administer menu' - _custom_access: '\Drupal\menu_ui\Form\MenuLinkResetForm::linkIsResetable' + _custom_access: '\Drupal\menu_ui\Form\MenuLinkResetForm::linkIsResettable' menu_ui.menu_add: path: '/admin/structure/menu/add' diff --git a/core/modules/menu_ui/src/Form/MenuDeleteForm.php b/core/modules/menu_ui/src/Form/MenuDeleteForm.php index a4ca8ec..ca51512 100644 --- a/core/modules/menu_ui/src/Form/MenuDeleteForm.php +++ b/core/modules/menu_ui/src/Form/MenuDeleteForm.php @@ -104,7 +104,7 @@ public function submit(array $form, array &$form_state) { // @todo - there ought to be a better way. $menu_links = $this->menuLinkManager->loadLinksByRoute('menu_ui.menu_edit', array('menu' => $this->entity->id()), TRUE); foreach ($menu_links as $id => $link) { - $this->menuLinkManager->deleteLink($id); + $this->menuLinkManager->removeDefinition($id); } // Delete the custom menu and all its menu links. diff --git a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php index b86b682..2b727e3 100644 --- a/core/modules/menu_ui/src/Form/MenuLinkResetForm.php +++ b/core/modules/menu_ui/src/Form/MenuLinkResetForm.php @@ -118,8 +118,8 @@ public function submitForm(array &$form, array &$form_state) { * Returns AccessInterface::ALLOW when access was granted, otherwise * AccessInterface::DENY. */ - public function linkIsResetable(MenuLinkInterface $menu_link_plugin) { - return $menu_link_plugin->isResetable() ? AccessInterface::ALLOW : AccessInterface::DENY; + public function linkIsResettable(MenuLinkInterface $menu_link_plugin) { + return $menu_link_plugin->isResettable() ? AccessInterface::ALLOW : AccessInterface::DENY; } } diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php index 183c992..d3dad28 100644 --- a/core/modules/menu_ui/src/MenuForm.php +++ b/core/modules/menu_ui/src/MenuForm.php @@ -299,7 +299,7 @@ protected function buildOverviewTreeForm($tree, $delta) { ); } // Links can either be reset or deleted, not both. - if ($link->isResetable()) { + if ($link->isResettable()) { $operations['reset'] = array( 'title' => $this->t('Reset'), 'route_name' => 'menu_ui.link_reset', @@ -374,7 +374,7 @@ protected function submitOverviewForm(array $complete_form, array &$form_state) if ($updated_values) { // Use the ID from the actual plugin instance since the hidden value // in the form could be tampered with. - $this->menuLinkManager->updateLink($element['#item']->link->getPLuginId(), $updated_values); + $this->menuLinkManager->updateDefinition($element['#item']->link->getPLuginId(), $updated_values); } } } diff --git a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php index fd58515..ee2734e 100644 --- a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php +++ b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php @@ -40,7 +40,7 @@ public function testMenuBlock() { /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */ $menu_link_manager = $this->container->get('plugin.manager.menu.link'); // Move a link into the new menu. - $menu_link = $menu_link_manager->updateLink('test_page_test.test_page', array('menu_name' => 'llama', 'parent' => '')); + $menu_link = $menu_link_manager->updateDefinition('test_page_test.test_page', array('menu_name' => 'llama', 'parent' => '')); $block = $this->drupalPlaceBlock('system_menu_block:llama', array('label' => 'Llama', 'provider' => 'system', 'region' => 'footer')); // Prime the page cache. @@ -68,7 +68,7 @@ public function testMenuBlock() { $this->verifyPageCache($path, 'HIT'); // Verify that after modifying the menu link weight, there is a cache miss. - $menu_link_manager->updateLink('test_page_test.test_page', array('weight' => -10)); + $menu_link_manager->updateDefinition('test_page_test.test_page', array('weight' => -10)); $this->pass('Test modification of menu link.', 'Debug'); $this->verifyPageCache($path, 'MISS'); @@ -94,7 +94,7 @@ public function testMenuBlock() { // Verify that after resetting the first menu link, there is a cache miss. $this->pass('Test reset of menu link.', 'Debug'); - $this->assertTrue($menu_link->isResetable(), 'First link can be reset'); + $this->assertTrue($menu_link->isResettable(), 'First link can be reset'); $menu_link = $menu_link_manager->resetLink($menu_link->getPluginId()); $this->verifyPageCache($path, 'MISS'); diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 459f1e6..ba4833a 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -119,7 +119,7 @@ public function overview($link_id) { drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the status report for more information.', array('@status' => url('admin/reports/status'))), 'error'); } $parameters = new MenuTreeParameters(); - $parameters->setRoot($link_id)->excludeRoot()->topLevelOnly()->excludeHiddenLinks(); + $parameters->setRoot($link_id)->excludeRoot()->setTopLevelOnly()->excludeHiddenLinks(); $tree = $this->menuLinkTree->load(NULL, $parameters); $manipulators = array( array('callable' => 'menu.default_tree_manipulators:checkAccess'), diff --git a/core/modules/system/src/SystemManager.php b/core/modules/system/src/SystemManager.php index 9027eb2..23a04ff 100644 --- a/core/modules/system/src/SystemManager.php +++ b/core/modules/system/src/SystemManager.php @@ -217,7 +217,7 @@ public function getAdminBlock(MenuLinkInterface $instance) { // Only find the children of this link. $link_id = $instance->getPluginId(); $parameters = new MenuTreeParameters(); - $parameters->setRoot($link_id)->excludeRoot()->topLevelOnly()->excludeHiddenLinks(); + $parameters->setRoot($link_id)->excludeRoot()->setTopLevelOnly()->excludeHiddenLinks(); $tree = $this->menuTree->load(NULL, $parameters); $manipulators = array( array('callable' => 'menu.default_tree_manipulators:checkAccess'), diff --git a/core/modules/system/src/Tests/Menu/LinksTest.php b/core/modules/system/src/Tests/Menu/LinksTest.php index 2ddad47..c9d4f10 100644 --- a/core/modules/system/src/Tests/Menu/LinksTest.php +++ b/core/modules/system/src/Tests/Menu/LinksTest.php @@ -143,7 +143,7 @@ function testMenuLinkReparenting($module = 'menu_test') { // childs of child-1 have been moved too. $links = $this->createLinkHierarchy($module); /* @var \Drupal\Core\Menu\MenuLinkInterface $menu_link_plugin */ - $this->menuLinkManager->updateLink($links['child-1'], array('parent' => $links['child-2'])); + $this->menuLinkManager->updateDefinition($links['child-1'], array('parent' => $links['child-2'])); // Verify that the entity was updated too. /* @var \Drupal\Core\Menu\MenuLinkInterface $menu_link_plugin */ $menu_link_plugin = $this->menuLinkManager->createInstance($links['child-1']); @@ -162,7 +162,7 @@ function testMenuLinkReparenting($module = 'menu_test') { // Start over, and delete child-1, and check that the children of child-1 // have been reassigned to the parent. $links = $this->createLinkHierarchy($module); - $this->menuLinkManager->deleteLink($links['child-1']); + $this->menuLinkManager->removeDefinition($links['child-1']); $expected_hierarchy = array( 'parent' => FALSE, diff --git a/core/modules/system/src/Tests/System/AdminTest.php b/core/modules/system/src/Tests/System/AdminTest.php index 90def02..35233c2 100644 --- a/core/modules/system/src/Tests/System/AdminTest.php +++ b/core/modules/system/src/Tests/System/AdminTest.php @@ -129,7 +129,7 @@ protected function getTopLevelMenuLinks() { // The system.admin link is normally the parent of all top-level admin links. $parameters = new MenuTreeParameters(); - $parameters->setRoot('system.admin')->excludeRoot()->topLevelOnly()->excludeHiddenLinks(); + $parameters->setRoot('system.admin')->excludeRoot()->setTopLevelOnly()->excludeHiddenLinks(); $tree = $menu_tree->load(NULL, $parameters); $manipulators = array( array('callable' => 'menu.default_tree_manipulators:checkAccess'), diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index cfee2e8..c486c9b 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -415,7 +415,7 @@ function toolbar_prerender_toolbar_administration_tray(array $element) { $menu_tree = \Drupal::menuTree(); // Render the top-level administration menu links. $parameters = new MenuTreeParameters(); - $parameters->setRoot('system.admin')->excludeRoot()->topLevelOnly()->excludeHiddenLinks(); + $parameters->setRoot('system.admin')->excludeRoot()->setTopLevelOnly()->excludeHiddenLinks(); $tree = $menu_tree->load(NULL, $parameters); $manipulators = array( array('callable' => 'menu.default_tree_manipulators:checkAccess'), diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 8df35e0..8c129fe 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -46,7 +46,7 @@ function standard_install() { // Enable the Contact link in the footer menu. /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */ $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); - $menu_link_manager->updateLink('contact.site_page', array('hidden' => 0)); + $menu_link_manager->updateDefinition('contact.site_page', array('hidden' => 0)); user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access site-wide contact form'));