A recent study showed the drop down save button on entity forms were quite confusing.

There have been changed to a simple "Published" checkbox above a standard save button.

This change has resulted in updates to \Drupal\node\NodeForm to remove the drop buttons which were 'publish' and 'unpublish' actions. The remaining actions in the node form are 'submit', 'preview', and 'delete'. This should be taken into account in contrib or custom modules, which are altering the node form. Furthermore, any tests that interact with the node form need to updated for the new button labels. The previous Save and publish, Save and unpublish, Save and keep published and Save as unpublished buttons are all replaced by the new Save button.

Submitting the node form in a test without changing status:

// Before this change:
$this->drupalPostForm('node/1/edit', $edit, t('Save as unpublished'));
$this->drupalPostForm('node/1/edit', $edit, t('Save and keep published'));

// After this change:
$this->drupalPostForm('node/1/edit', $edit, t('Save'));
Submitting the node form in a test with changing status:

// Before this change:
$this->drupalPostForm('node/1/edit', $edit, t('Save and unpublish'));
$this->drupalPostForm('node/1/edit', $edit, t('Save and publish'));

// After this change:
$edit = ['status[value]' => FALSE];
$this->drupalPostForm('node/1/edit', $edit, t('Save'));

$edit = ['status[value]' => TRUE];
$this->drupalPostForm('node/1/edit', $edit, t('Save'));
When using the frontend theme for creating/editing content (either because selected in /admin/appearance or because of permissions) please be aware this change might affect the custom or contrib theme you're using. The markup including classes used have changed on the Node form.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pifagor created an issue. See original summary.

pifagor’s picture

pifagor’s picture

Priority: Normal » Critical
sjerdo’s picture

Status: Needs review » Reviewed & tested by the community

LGTM +1

  • pifagor committed e6828ca on 8.x-1.x
    Issue #2957690 by pifagor: "Save and Publish" button on entity forms...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.