diff --git a/core/includes/theme.inc b/core/includes/theme.inc index bab2af5..08464ab 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1845,6 +1845,24 @@ function theme_dropbutton_wrapper($variables) { } /** + * Returns HTML for wrapping a dropbutton list. + * + * Use this function if the dropbutton contains submit buttons. These elements + * need to have a #prefix and #suffix element that wraps those into an
  • + * element. + * + * @param array $variables + * An associative array containing: + * - element: An associative array containing the properties and children of + * the dropbutton list. Properties used: #children. + */ +function theme_dropbutton_list_wrapper($variables) { + if (!empty($variables['element']['#children'])) { + return ''; + } +} + +/** * Returns HTML for an image. * * @param $variables @@ -3155,6 +3173,9 @@ function drupal_common_theme() { 'dropbutton_wrapper' => array( 'render element' => 'element', ), + 'dropbutton_list_wrapper' => array( + 'render element' => 'element', + ), 'image' => array( // HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft // allows the alt attribute to be omitted in some cases. Therefore, diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php index 9d7dd30..9d30a2f 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldDisplayTest.php @@ -64,7 +64,7 @@ function testNodeDisplay() { // Turn the "display" option off and check that the file is no longer displayed. $edit = array($field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][display]' => FALSE); - $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save')); + $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published')); $this->assertNoRaw($default_output, t('Field is hidden when "display" option is unchecked.')); diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php index 480f411..47d19d1 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php @@ -71,7 +71,7 @@ function testRevisions() { // Save a new version of the node without any changes. // Check that the file is still the same as the previous revision. - $this->drupalPost('node/' . $nid . '/edit', array('revision' => '1'), t('Save')); + $this->drupalPost('node/' . $nid . '/edit', array('revision' => '1'), t('Save and keep published')); $node = node_load($nid, TRUE); $node_file_r3 = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']); $node_vid_r3 = $node->vid; diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php index 458eb4c..60b5f52 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php @@ -149,7 +149,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, // Attach a file to the node. $edit['files[' . $field_name . '_' . $langcode . '_0]'] = drupal_realpath($file->uri); - $this->drupalPost("node/$nid/edit", $edit, t('Save')); + $this->drupalPost("node/$nid/edit", $edit, t('Save and keep published')); return $nid; } @@ -165,7 +165,7 @@ function removeNodeFile($nid, $new_revision = TRUE) { ); $this->drupalPost('node/' . $nid . '/edit', array(), t('Remove')); - $this->drupalPost(NULL, $edit, t('Save')); + $this->drupalPost(NULL, $edit, t('Save and keep published')); } /** @@ -178,7 +178,7 @@ function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) { ); $this->drupalPost('node/' . $nid . '/edit', array(), t('Remove')); - $this->drupalPost(NULL, $edit, t('Save')); + $this->drupalPost(NULL, $edit, t('Save and keep published')); } /** diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php index 050931b..7a40a1c 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php @@ -37,7 +37,7 @@ function testRequired() { // Try to post a new node without uploading a file. $langcode = LANGUAGE_NOT_SPECIFIED; $edit = array("title" => $this->randomName()); - $this->drupalPost('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPost('node/add/' . $type_name, $edit, t('Save and publish')); $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.')); // Create a new node with the uploaded file. @@ -56,7 +56,7 @@ function testRequired() { // Try to post a new node without uploading a file in the multivalue field. $edit = array('title' => $this->randomName()); - $this->drupalPost('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPost('node/add/' . $type_name, $edit, t('Save and publish')); $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required multiple value file field was empty.')); // Create a new node with the uploaded file into the multivalue field. diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php index 7fcf35f..3d5f782 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php @@ -73,7 +73,7 @@ function testSingleValuedWidget() { $this->assertTrue(isset($label[0]), 'Label for upload found.'); // Save the node and ensure it does not have the file. - $this->drupalPost(NULL, array(), t('Save')); + $this->drupalPost(NULL, array(), t('Save and keep published')); $node = node_load($nid, TRUE); $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']), t('File was successfully removed from the node.')); } @@ -191,7 +191,7 @@ function testMultiValuedWidget() { $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), t('After removing all files, there is no "Remove" button displayed (JSMode=%type).', array('%type' => $type))); // Save the node and ensure it does not have any files. - $this->drupalPost(NULL, array('title' => $this->randomName()), t('Save')); + $this->drupalPost(NULL, array('title' => $this->randomName()), t('Save and publish')); $matches = array(); preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches); $nid = $matches[1]; @@ -268,7 +268,7 @@ function testPrivateFileComment() { $edit = array( 'title' => $this->randomName(), ); - $this->drupalPost('node/add/article', $edit, t('Save')); + $this->drupalPost('node/add/article', $edit, t('Save and publish')); $node = $this->drupalGetNodeByTitle($edit['title']); // Add a comment with a file. @@ -302,10 +302,7 @@ function testPrivateFileComment() { // Unpublishes node. $this->drupalLogin($this->admin_user); - $edit = array( - 'status' => FALSE, - ); - $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', array(), t('Save and unpublish')); // Ensures normal user can no longer download the file. $this->drupalLogin($user); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php index e7b1330..a54a739 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php @@ -219,7 +219,7 @@ function testFilterAdmin() { $edit["title"] = $this->randomName(); $edit["body[$langcode][0][value]"] = $text; $edit["body[$langcode][0][format]"] = $filtered; - $this->drupalPost('node/add/page', $edit, t('Save')); + $this->drupalPost('node/add/page', $edit, t('Save and publish')); $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), 'Filtered node created.'); $node = $this->drupalGetNodeByTitle($edit["title"]); @@ -231,7 +231,7 @@ function testFilterAdmin() { // Use plain text and see if it escapes all tags, whether allowed or not. $edit = array(); $edit["body[$langcode][0][format]"] = $plain; - $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save and keep published')); $this->drupalGet('node/' . $node->nid); $this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.'); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php index a71a9e9..ce6372e 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormatAccessTest.php @@ -207,7 +207,7 @@ function testFormatWidgetPermissions() { $edit['title'] = $this->randomName(8); $edit[$body_value_key] = $this->randomName(16); $edit[$body_format_key] = $this->disallowed_format->format; - $this->drupalPost('node/add/page', $edit, t('Save')); + $this->drupalPost('node/add/page', $edit, t('Save and publish')); $node = $this->drupalGetNodeByTitle($edit['title']); // Try to edit with a less privileged user. diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php index 71e89fb..442eff4 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterHooksTest.php @@ -71,7 +71,7 @@ function testFilterHooks() { "body[$language_not_specified][0][value]" => $this->randomName(32), "body[$language_not_specified][0][format]" => $format_id, ); - $this->drupalPost("node/add/{$type->type}", $edit, t('Save')); + $this->drupalPost("node/add/{$type->type}", $edit, t('Save and publish')); $this->assertText(t('@type @title has been created.', array('@type' => $type_name, '@title' => $title))); // Disable the text format. diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php index f36c5a9..d54e30a 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php @@ -172,7 +172,7 @@ protected function createForumTopics($count = 5) { ); // Create the forum topic, preselecting the forum ID via a URL parameter. - $this->drupalPost('node/add/forum/1', $edit, t('Save')); + $this->drupalPost('node/add/forum/1', $edit, t('Save and publish')); $topics[] = $title; } diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php index 7ae7d5f..27e4384 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php @@ -55,7 +55,7 @@ function testForumIndexStatus() { ); // Create the forum topic, preselecting the forum ID via a URL parameter. - $this->drupalPost('node/add/forum/' . $tid, $edit, t('Save')); + $this->drupalPost('node/add/forum/' . $tid, $edit, t('Save and publish')); // Check that the node exists in the database. $node = $this->drupalGetNodeByTitle($title); @@ -66,10 +66,7 @@ function testForumIndexStatus() { $this->assertText($title, 'Published forum topic appears on index.'); // Unpublish the node. - $edit = array( - 'status' => FALSE, - ); - $this->drupalPost("node/{$node->nid}/edit", $edit, t('Save')); + $this->drupalPost("node/{$node->nid}/edit", array(), t('Save and unpublish')); $this->drupalGet("node/{$node->nid}"); $this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.'); diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php index 1cfda9f..7c42a5b 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php @@ -187,7 +187,7 @@ function testImageFieldSettings() { $field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][alt]' => $image_info['alt'], $field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][title]' => $image_info['title'], ); - $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save')); + $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published')); $default_output = theme('image', $image_info); $this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.'); @@ -197,7 +197,7 @@ function testImageFieldSettings() { $field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][alt]' => $this->randomName($test_size), $field_name . '[' . LANGUAGE_NOT_SPECIFIED . '][0][title]' => $this->randomName($test_size), ); - $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save')); + $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save and keep published')); $this->assertRaw(t('Alternate text cannot be longer than %max characters but is currently %length characters long.', array( '%max' => $schema['fields'][$field_name .'_alt']['length'], '%length' => $test_size, diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php index f3f7f86..5a4e20e 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php @@ -118,7 +118,7 @@ function uploadNodeImage($image, $field_name, $type) { 'title' => $this->randomName(), ); $edit['files[' . $field_name . '_' . LANGUAGE_NOT_SPECIFIED . '_0]'] = drupal_realpath($image->uri); - $this->drupalPost('node/add/' . $type, $edit, t('Save')); + $this->drupalPost('node/add/' . $type, $edit, t('Save and publish')); // Retrieve ID of the newly created node from the current URL. $matches = array(); diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index 47e1f30..a7354ee 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -239,7 +239,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { $form['options'] = array( '#type' => 'details', '#access' => user_access('administer nodes'), - '#title' => t('Publishing options'), + '#title' => t('Promotion options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'advanced', @@ -252,12 +252,6 @@ public function form(array $form, array &$form_state, EntityInterface $node) { '#weight' => 95, ); - $form['options']['status'] = array( - '#type' => 'checkbox', - '#title' => t('Published'), - '#default_value' => $node->status, - ); - $form['options']['promote'] = array( '#type' => 'checkbox', '#title' => t('Promoted to front page'), @@ -281,6 +275,89 @@ public function form(array $form, array &$form_state, EntityInterface $node) { } /** + * Overrides Drupal\entity\EntityFormController::actionsElement(). + */ + protected function actionsElement(array $form, array &$form_state) { + $element = parent::actionsElement($form, $form_state); + $node = $this->getEntity($form_state); + + // Because some of the 'links' are actually submit buttons, we have to + // manually wrap each item in
  • and the whole list in