Commit 341e8d61 authored by alexpott's avatar alexpott

Issue #2321913 by Temoor: Replace all instances of...

Issue #2321913 by Temoor: Replace all instances of entity_load('menu_link_content') and entity_load_multiple('menu_link_content') with static method calls.
parent 7e23170d
......@@ -196,7 +196,7 @@ function menu_ui_node_save(EntityInterface $node) {
$definition = $node->menu;
if (trim($definition['title'])) {
if (!empty($definition['entity_id'])) {
$entity = entity_load('menu_link_content', $definition['entity_id']);
$entity = MenuLinkContent::load($definition['entity_id']);
$entity->enabled->value = 1;
$entity->title->value = trim($definition['title']);
$entity->description->value = trim($definition['description']);
......@@ -412,7 +412,7 @@ function menu_ui_node_submit(EntityInterface $node, $form, FormStateInterface $f
$definition = $form_state->getValue('menu');
if (empty($definition['enabled'])) {
if ($definition['entity_id']) {
$entity = entity_load('menu_link_content', $definition['entity_id']);
$entity = MenuLinkContent::load($definition['entity_id']);
$entity->delete();
}
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\menu_ui\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\menu_link_content\Entity\MenuLinkContent;
/**
* Add, edit, and delete a node with menu link.
......@@ -140,7 +141,7 @@ function testMenuNodeFormWidget() {
$this->assertText('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
// Assert that the link is still in the Administration menu after save.
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$link = entity_load('menu_link_content', $item->id());
$link = MenuLinkContent::load($item->id());
$this->assertTrue($link, 'Link in not allowed menu still exists after saving node');
// Move the menu link back to the Tools menu.
......
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