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.
Comment | File | Size | Author |
---|---|---|---|
#2 | xmlsitemap_tests-2957690-2.patch | 3.08 KB | pifagor |
Comments
Comment #2
pifagorComment #3
pifagorComment #4
sjerdoLGTM +1
Comment #6
pifagor