Issue #2475805 by tstoeckler, googletorp, webwarrior: menu_ui_form_node_form_submit() is called when the Preview button is pressed which fatals
parent
73cf5bd62a
commit
d0ac10561d
|
@ -334,7 +334,7 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) {
|
|||
);
|
||||
|
||||
foreach (array_keys($form['actions']) as $action) {
|
||||
if (isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
|
||||
if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
|
||||
$form['actions'][$action]['#submit'][] = 'menu_ui_form_node_form_submit';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,14 @@ class MenuNodeTest extends WebTestBase {
|
|||
$this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type'));
|
||||
$this->assertRaw(t('The content type %name has been updated.', array('%name' => 'Basic page')));
|
||||
|
||||
// Test that we can preview a node that will create a menu item.
|
||||
$edit = array(
|
||||
'title[0][value]' => $node_title,
|
||||
'menu[enabled]' => 1,
|
||||
'menu[title]' => 'Test preview',
|
||||
);
|
||||
$this->drupalPostForm('node/add/page', $edit, t('Preview'));
|
||||
|
||||
// Create a node.
|
||||
$node_title = $this->randomMachineName();
|
||||
$edit = array(
|
||||
|
|
Loading…
Reference in New Issue