What I often need is a redirect to the previous page after creating a node (for example a task).
When the task node create form is embedded in the tasks overview page (as a panel pane for example) as form block, a refresh of the current page is needed after task creation.

CommentFileSizeAuthor
#3 redirect-current-page-2425477-3.patch724 bytesmarabak
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rob Holmes’s picture

Hi, did you have any ideas on how to implement this functionality? If you make a start i am more than happy to finish it off and commit it.

NancyDru’s picture

Before I got NSR working, I was adding $_GET['q'] to a field in the node form and then redirecting to it from the submission handler.

$form['where_to'] = $_GET['q'];

...

$form_state['redirect'] = $form['where_to'];

marabak’s picture

Hi,
I'm using this module to make drupal stay on the node's edit form after saving it - but with vertical tabs you can have a url pointing directly to a particular tab :

node/nid/edit/#id-of-the-vertical-tab

i've made a patch for this using the form hidden value : additional_settings__active_tab

Rob Holmes’s picture

Ill try and get this tested and committed, we might have to make a conditional check for the existence of 'additional_settings__active_tab' before adding it as a fragment.

Rob Holmes’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev

Moving to D8 first, backport later.

coaston’s picture

Hello,
Is there any update? Really need to get back to previous page after create a new task.
I do have a content type School and I do have another content type building. In school I do have a views with building and added button to create a new building with the reference to School id (prepopulate). Once I save and create new building I am redirected to new building page, however need to get back to School - so previous page.

coaston’s picture

Prepopulate module did the trick in my case #6:
https://www.drupal.org/project/prepopulate/issues/3171915