Skip to content
Snippets Groups Projects
Commit 8d571379 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2321919 by Temoor: Replace all instances of menu_load(),...

Issue #2321919 by Temoor: Replace all instances of menu_load(), entity_load('menu') and entity_load_multiple('menu') with static method calls.
parent 109b8959
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -534,7 +534,7 @@ function menu_ui_form_node_type_form_submit(&$form, FormStateInterface $form_sta
* titles as the values.
*/
function menu_ui_get_menus($all = TRUE) {
if ($custom_menus = entity_load_multiple('menu')) {
if ($custom_menus = Menu::loadMultiple()) {
if (!$all) {
$custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
}
......@@ -565,7 +565,7 @@ function menu_ui_system_breadcrumb_alter(array &$breadcrumb, RouteMatchInterface
if (($route_match->getRouteName() == 'menu_ui.link_edit') && $menu_link = $route_match->getParameter('menu_link_plugin')) {
if (($menu_link instanceof MenuLinkInterface)) {
// Add a link to the menu admin screen.
$menu = entity_load('menu', $menu_link->getMenuName());
$menu = Menu::load($menu_link->getMenuName());
$breadcrumb[] = \Drupal::l($menu->label(), 'menu_ui.menu_edit', array('menu' => $menu->id()));
}
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\menu_ui\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\system\Entity\Menu;
/**
* Tests that uninstalling menu does not remove custom menus.
......@@ -29,7 +30,9 @@ class MenuUninstallTest extends WebTestBase {
public function testMenuUninstall() {
\Drupal::moduleHandler()->uninstall(array('menu_ui'));
$this->assertTrue(entity_load('menu', 'admin', TRUE), 'The \'admin\' menu still exists after uninstalling Menu UI module.');
\Drupal::entityManager()->getStorage('menu')->resetCache(array('admin'));
$this->assertTrue(Menu::load('admin'), 'The \'admin\' menu still exists after uninstalling Menu UI module.');
}
}
......@@ -11,6 +11,7 @@
use Drupal\migrate\MigrateMessage;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
use Drupal\Core\Database\Database;
use Drupal\system\Entity\Menu;
/**
* Upgrade menus to system.menu.*.yml.
......@@ -37,7 +38,7 @@ public function setUp() {
* Tests the Drupal 6 menu to Drupal 8 migration.
*/
public function testMenu() {
$navigation_menu = entity_load('menu', 'navigation');
$navigation_menu = Menu::load('navigation');
$this->assertEqual($navigation_menu->id(), 'navigation');
$this->assertEqual($navigation_menu->label(), 'Navigation');
$this->assertEqual($navigation_menu->description , 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment