Commit 586900ec authored by catch's avatar catch
Browse files

Issue #1763002 by dcam, idebr, David_Rothstein, marthinal, aerozeppelin,...

Issue #1763002 by dcam, idebr, David_Rothstein, marthinal, aerozeppelin, Lendude, wturrell, Abhijith S, vaibhavjain, nayana_mvr, smustgrave: Saving a node with an empty menu link title causes the menu link to silently not be created
parent b64011be
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -327,7 +327,11 @@ function menu_ui_form_node_form_submit($form, FormStateInterface $form_state) {
        $entity->delete();
      }
    }
    elseif (trim($values['title'])) {
    else {
      // In case the menu title was left empty, fall back to the node title.
      if (empty(trim($values['title']))) {
        $values['title'] = $node->label();
      }
      // Decompose the selected menu parent option into 'menu_name' and 'parent',
      // if the form used the default parent selection widget.
      if (!empty($values['menu_parent'])) {
+2 −2
Original line number Diff line number Diff line
@@ -157,9 +157,9 @@ public function testMenuNodeFormWidget() {
    ];
    $this->drupalGet('node/' . $node->id() . '/edit');
    $this->submitForm($edit, 'Save');
    // Assert that there is no link for the node.
    // Assert that there is a link for the node.
    $this->drupalGet('test-page');
    $this->assertSession()->linkNotExists($node_title);
    $this->assertSession()->linkExists($node_title);

    // Make sure the menu links only appear when the node is published.
    // These buttons just appear for 'administer nodes' users.