Skip to content

Instantly share code, notes, and snippets.

@juampynr
Last active November 9, 2020 18:34
Show Gist options
  • Select an option

  • Save juampynr/660219418bde29b6d107 to your computer and use it in GitHub Desktop.

Select an option

Save juampynr/660219418bde29b6d107 to your computer and use it in GitHub Desktop.

Revisions

  1. juampynr revised this gist Nov 9, 2020. No changes.
  2. juampynr revised this gist Nov 9, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ Drupal 7's default behavior is to redirect the user to the full display of a nod
    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.

    For Drupal 8 or 9, have a look at the comment below by @zanvidmar.

    ## Acknowledgements

    * [msnbc](http://www.msnbc.com)
  3. juampynr revised this gist Nov 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Drupal's default behavior is to redirect the user to the full display of a node after it has been saved.
    Drupal 7'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.
  4. Juampy revised this gist May 27, 2015. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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.

    ## Acknowledgements

    * [msnbc](http://www.msnbc.com)
    * [Karen Stevenson](https://www.lullabot.com/who-we-are/karen-stevenson)
  5. Juampy created this gist May 27, 2015.
    16 changes: 16 additions & 0 deletions mymodule.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    /**
    * 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['redirect'] = 'node/' . $form_state['nid'] . '/edit/';
    }