0

I have a function that is called by hook-menu item an is accesible from different subpages of the site. This function does not return any html, it just do some database inserts and should redirect user back where he came from.

Well, it could be easily done by adding url args as a parameters to this function and then use drupal_goto() with those arguments. But I'm wondering if there is any drupal function for this. I was trying drupal_goto(drupal_get_destination()); but it does nothing.

2

Create your link this way:

$link = l('Link title', 'your/menu/path', array('query' => drupal_get_destination));

This will add the destination argument to the link URL.

Then, at the end of your page callback, simply call:

drupal_goto();
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.