Skip to content
Snippets Groups Projects
Commit d0ac1056 authored by Jess's avatar Jess
Browse files

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
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment