Drupal's default behavior is to redirect the user to the full display of a node after it has been saved.
If you want to stay in the edit form after saving, add this snippet to a custom module adjusting the module namespace in the two functions.
Drupal's default behavior is to redirect the user to the full display of a node after it has been saved.
If you want to stay in the edit form after saving, add this snippet to a custom module adjusting the module namespace in the two functions.
/** | |
* Implements hook_form_BASE_FORM_ID_alter(). | |
*/ | |
function mymodule_form_node_form_alter(&$form, &$form_state, $form_id) { | |
$form['actions']['submit']['#submit'][] = '_mymodule_node_submit_redirect'; | |
} | |
/** | |
* Extra node form submit handler. Done this way to override the default. | |
*/ | |
function _mymodule_node_submit_redirect($form, &$form_state) { | |
if (isset($_GET['destination'])) { | |
unset($_GET['destination']); | |
} | |
$form_state->setRedirect('entity.node.edit_form', ['node' => $form_state->getValue('nid')]); | |
} |