diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index f08e4c9..af7d354 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -291,24 +291,33 @@ protected function actions(array $form, array &$form_state) { // need a way to plug themselves into 1) the ::submit() step, and // 2) the ::save() step, both decoupled from the pressed form button. if ($element['submit']['#access'] && user_access('administer nodes')) { - // isNew | prev status » default & publish label & unpublish label - // 1 | 0 » Unpublish & Publish & Unpublish - // 1 | 1 » Publish & Publish & Unpublish - // 0 | 0 » Unpublish & Publish & Keep unpublished - // 0 | 1 » Publish & Keep published & Unpublish - $keep = !$node->isNew(); + // isNew | prev status » default & publish label & unpublish label + // 1 | 1 » publish & Save and publish & Save as unpublished + // 1 | 0 » unpublish & Save and publish & Save as unpublished + // 0 | 1 » publish & Save and keep published & Save and unpublish + // 0 | 0 » unpublish & Save and keep unpublished & Save and publish // Add a "Publish" button. $element['publish'] = $element['submit']; $element['publish']['#dropbutton'] = 'save'; - $element['publish']['#value'] = $keep && $node->status ? t('Save and keep published') : t('Save and publish'); + if ($node->isNew()) { + $element['publish']['#value'] = t('Save and publish'); + } + else { + $element['publish']['#value'] = $node->status ? t('Save and keep published') : t('Save and publish'); + } $element['publish']['#weight'] = 0; array_unshift($element['publish']['#submit'], array($this, 'publish')); // Add a "Unpublish" button. $element['unpublish'] = $element['submit']; $element['unpublish']['#dropbutton'] = 'save'; - $element['unpublish']['#value'] = $keep && !$node->status ? t('Save and keep unpublished') : t('Save as unpublished'); + if ($node->isNew()) { + $element['unpublish']['#value'] = t('Save as unpublished'); + } + else { + $element['unpublish']['#value'] = !$node->status ? t('Save and keep unpublished') : t('Save and unpublish'); + } $element['unpublish']['#weight'] = 10; array_unshift($element['unpublish']['#submit'], array($this, 'unpublish'));