Commit d0ac1056 authored by xjm's avatar xjm

Issue #2475805 by tstoeckler, googletorp, webwarrior:...

Issue #2475805 by tstoeckler, googletorp, webwarrior: menu_ui_form_node_form_submit() is called when the Preview button is pressed which fatals
parent 73cf5bd6
......@@ -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 @@ function testMenuNodeFormWidget() {
$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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment