diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php index 4f93ce0..053e8da 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php @@ -300,7 +300,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { // Unpublishes node. $this->drupalLogin($this->admin_user); $edit = array( - 'status' => FALSE, + 'status' => 0, ); $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php index a9d1a7c..4cc271c 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumIndexTest.php @@ -67,7 +67,7 @@ class ForumIndexTest extends WebTestBase { // Unpublish the node. $edit = array( - 'status' => FALSE, + 'status' => 0, ); $this->drupalPost("node/{$node->nid}/edit", $edit, t('Save')); $this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.'); diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index c5763e8..360c328 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -200,7 +200,7 @@ class NodeFormController extends EntityFormController { $form['options'] = array( '#type' => 'fieldset', '#access' => user_access('administer nodes'), - '#title' => t('Publishing options'), + '#title' => t('Promotion options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', @@ -213,12 +213,6 @@ class NodeFormController extends EntityFormController { '#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'), @@ -242,6 +236,42 @@ class NodeFormController extends EntityFormController { } /** + * Overrides Drupal\entity\EntityFormController::actionsElement(). + */ + protected function actionsElement(array $form, array &$form_state) { + $element = parent::actionsElement($form, $form_state); + $node = $this->getEntity($form_state); + + // Add a nested fieldset to contain the save button and publication status + // select control. + $element['save'] = array( + '#type' => 'container', + '#attributes' => array('class' => array('form-action-group', 'container-inline')), + ); + + // Move the submit button into the new container. + $element['save']['submit'] = $element['submit']; + unset($element['submit']); + + // Add widget to handle setting / adjusting the node's published status. + $element['save']['status'] = array( + '#type' => 'select', + '#options' => array( + 0 => t('Not published'), + 1 => t('Published'), + ), + '#default_value' => $node->status, + '#weight' => 10, + ); + + // Add an additional button_type attribute to the preview button so that + // themes / modules can target it more easily. + $element['preview']['#button_type'] = 'preview'; + + return $element; + } + + /** * Overrides Drupal\entity\EntityFormController::actions(). */ protected function actions(array $form, array &$form_state) { diff --git a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php index abb31f3..4d310f1 100644 --- a/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php @@ -49,7 +49,7 @@ class MultiStepNodeFormBasicOptionsTest extends WebTestBase { 'choice[new:1][chtext]' => 'a', ); $this->drupalPost('node/add/poll', $edit, t('Add another choice')); - $this->assertNoFieldChecked('edit-status', 'status stayed unchecked'); + $this->assertFieldById('edit-status', 0, 'status stayed not published'); $this->assertNoFieldChecked('edit-promote', 'promote stayed unchecked'); $this->assertFieldChecked('edit-sticky', 'sticky stayed checked'); } diff --git a/core/modules/node/node.js b/core/modules/node/node.js index 0899d3c..2ee23f7 100644 --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -33,14 +33,15 @@ Drupal.behaviors.nodeFieldsetSummaries = { var $context = $(context); var vals = []; - $context.find('input:checked').parent().each(function () { - vals.push(Drupal.checkPlain($.trim($(this).text()))); - }); - - if (!$context.find('.form-item-status input').is(':checked')) { - vals.unshift(Drupal.t('Not published')); + if ($context.find('input').is(':checked')) { + $context.find('input:checked').parent().each(function () { + vals.push(Drupal.checkPlain($.trim($(this).text()))); + }); + return vals.join(', '); + } + else { + return Drupal.t('Not promoted'); } - return vals.join(', '); }); } }; diff --git a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php index a409150..045d2ae 100644 --- a/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php +++ b/core/modules/translation/lib/Drupal/translation/Tests/TranslationTest.php @@ -170,7 +170,7 @@ class TranslationTest extends WebTestBase { // Unpublish the Spanish translation to check that the related language // switch link is not shown. $this->drupalLogin($this->admin_user); - $edit = array('status' => FALSE); + $edit = array('status' => 0); $this->drupalPost("node/$translation_es->nid/edit", $edit, t('Save')); $this->drupalLogin($this->translator); $this->assertLanguageSwitchLinks($node, $translation_es, FALSE); @@ -181,7 +181,7 @@ class TranslationTest extends WebTestBase { $edit = array('language_interface[enabled][language-url]' => FALSE); $this->drupalPost('admin/config/regional/language/detection', $edit, t('Save settings')); $this->resetCaches(); - $edit = array('status' => TRUE); + $edit = array('status' => 1); $this->drupalPost("node/$translation_es->nid/edit", $edit, t('Save')); $this->drupalLogin($this->translator); $this->assertLanguageSwitchLinks($node, $translation_es, TRUE, 'node'); diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index 9b4ad81..c7ac615 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -733,6 +733,33 @@ div.filter-options select { } } +/* Form actions group */ +.form-action-group { + background-color: #eee; + border: 1px solid #ccc; + display: inline-block; + margin-top: -4px; + width: 240px; +} +.form-action-group * { + margin: 5px 2px +} +@media screen and (max-width: 600px) { + .form-action-group { + display: inline-block; + margin: 0; + width: 100%; + margin-bottom: 1em; + } + .node-form .form-action-group input { + display: inline-block; + width: 46%; + } + .node-form .form-action-group select { + width: 46%; + } +} + /** * System. */