Commit abfdc5ec authored by webchick's avatar webchick

Issue #2495407 by jhedstrom, Noe_, cilefen: Regression: Editing a node with a...

Issue #2495407 by jhedstrom, Noe_, cilefen: Regression: Editing a node with a disabled menu link re-enables that menu link
parent 1b355bc4
......@@ -146,8 +146,8 @@ function _menu_ui_node_save(NodeInterface $node, array $values) {
'link' => ['uri' => 'entity:node/' . $node->id()],
'langcode' => $node->getUntranslated()->language()->getId(),
));
$entity->enabled->value = 1;
}
$entity->enabled->value = 1;
$entity->title->value = trim($values['title']);
$entity->description->value = trim($values['description']);
$entity->menu_name->value = $values['menu_name'];
......
......@@ -171,6 +171,16 @@ function testMenuNodeFormWidget() {
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldById('edit-menu-weight', 17, 'Menu weight correct in edit form');
// Disable the menu link, then edit the node--the link should stay disabled.
$link_id = menu_ui_get_menu_link_defaults($node)['entity_id'];
/** @var \Drupal\menu_link_content\Entity\MenuLinkContent $link */
$link = MenuLinkContent::load($link_id);
$link->set('enabled', FALSE);
$link->save();
$this->drupalPostForm($node->urlInfo('edit-form'), $edit, t('Save'));
$link = MenuLinkContent::load($link_id);
$this->assertFalse($link->isEnabled(), 'Saving a node with a disabled menu link keeps the menu link disabled.');
// Edit the node and remove the menu link.
$edit = array(
'menu[enabled]' => FALSE,
......
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