diff -u b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml --- b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml +++ b/core/modules/book/config/install/core.entity_form_display.node.book.default.yml @@ -30,6 +30,12 @@ display_label: true weight: 15 third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 120 + third_party_settings: { } sticky: type: boolean_checkbox settings: @@ -53,8 +59,2 @@ third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 100 - third_party_settings: { } hidden: { } diff -u b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml --- b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml +++ b/core/modules/forum/config/install/core.entity_form_display.node.forum.default.yml @@ -38,6 +38,12 @@ display_label: true weight: 15 third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 100 + third_party_settings: { } sticky: type: boolean_checkbox settings: @@ -66,8 +72,2 @@ third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 100 - third_party_settings: { } hidden: { } diff -u b/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php --- b/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -408,7 +408,7 @@ 'settings' => array( 'display_label' => TRUE, ), - 'weight' => 150, + 'weight' => 120, )) ->setDisplayConfigurable('form', TRUE); diff -u b/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php --- b/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -239,6 +239,8 @@ $node = $this->entity; $preview_mode = $node->type->entity->getPreviewMode(); + $element['submit']['#access'] = $preview_mode != DRUPAL_REQUIRED || $this->hasBeenPreviewed; + $element['preview'] = array( '#type' => 'submit', '#access' => $preview_mode != DRUPAL_DISABLED && ($node->access('create') || $node->access('update')), diff -u b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml --- b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml +++ b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml @@ -58,6 +58,12 @@ display_label: true weight: 15 third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 100 + third_party_settings: { } sticky: type: boolean_checkbox settings: @@ -81,8 +87,2 @@ third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 100 - third_party_settings: { } hidden: { } diff -u b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml --- b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml +++ b/core/profiles/standard/config/install/core.entity_form_display.node.page.default.yml @@ -36,6 +36,12 @@ display_label: true weight: 15 third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 100 + third_party_settings: { } sticky: type: boolean_checkbox settings: @@ -59,8 +65,2 @@ third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 100 - third_party_settings: { } hidden: { } only in patch2: unchanged: --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -334,11 +334,7 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) { '#description' => t('Menu links with lower weights are displayed before links with higher weights.'), ); - foreach (array_keys($form['actions']) as $action) { - if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') { - $form['actions'][$action]['#submit'][] = 'menu_ui_form_node_form_submit'; - } - } + $form['actions']['submit']['#submit'][] = 'menu_ui_form_node_form_submit'; } /** only in patch2: unchanged: --- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php +++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php @@ -18,13 +18,6 @@ class MenuNodeTest extends WebTestBase { /** - * An editor user. - * - * @var \Drupal\user\UserInterface - */ - protected $editor; - - /** * Modules to enable. * * @var array @@ -39,15 +32,14 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); - $this->editor = $this->drupalCreateUser(array( + $this->drupalLogin($this->drupalCreateUser(array( 'access administration pages', 'administer content types', 'administer menu', 'create page content', 'edit any page content', 'delete any page content', - )); - $this->drupalLogin($this->editor); + ))); } /** @@ -128,36 +120,6 @@ function testMenuNodeFormWidget() { $this->drupalGet('test-page'); $this->assertNoLink($node_title); - // Use not only the save button, but also the two special buttons: - // 'Save and publish' as well as 'Save and keep published'. - // These buttons just appear for 'administer nodes' users. - $admin_user = $this->drupalCreateUser([ - 'access administration pages', - 'administer content types', - 'administer nodes', - 'administer menu', - 'create page content', - 'edit any page content', - ]); - $this->drupalLogin($admin_user); - foreach (['Save and unpublish' => FALSE, 'Save and keep unpublished' => FALSE, 'Save and publish' => TRUE, 'Save and keep published' => TRUE] as $submit => $visible) { - $edit = [ - 'menu[enabled]' => 1, - 'menu[title]' => $node_title, - ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, $submit); - // Assert that the link exists. - $this->drupalGet('test-page'); - if ($visible) { - $this->assertLink($node_title, 0, 'Found a menu link after submitted with ' . $submit); - } - else { - $this->assertNoLink($node_title, 'Found no menu link after submitted with ' . $submit); - } - } - - // Log back in as normal user. - $this->drupalLogin($this->editor); // Edit the node and create a menu link. $edit = array( 'menu[enabled]' => 1,