drupal_get_destination

Versions
4.6 – 7
drupal_get_destination()

Prepare a destination query string for use in combination with drupal_goto().

Used to direct the user back to the referring page after completing a form. By default the current URL is returned. If a destination exists in the previous request, that destination is returned. As such, a destination can persist across multiple pages.

See also

drupal_goto()

▾ 16 functions call drupal_get_destination()

comment_admin_overview in modules/comment/comment.admin.inc
Form builder; Builds the comment overview form for the admin.
hook_translated_menu_link_alter in developer/hooks/core.php
Alter a menu link after it's translated, but before it's rendered.
node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_form_delete_submit in modules/node/node.pages.inc
Button sumit function: handle the 'Delete' button on the node form.
openid_authentication in modules/openid/openid.module
Authenticate a user or attempt registration.
openid_form_alter in modules/openid/openid.module
Implementation of hook_form_alter : adds OpenID login to the login forms.
path_admin_overview in modules/path/path.admin.inc
Return a listing of all defined URL aliases. When filter key passed, perform a standard search on the given key, and return the list of matching URL aliases.
statistics_top_visitors in modules/statistics/statistics.admin.inc
Menu callback; presents the "top visitors" page.
taxonomy_overview_terms in modules/taxonomy/taxonomy.admin.inc
Form builder for the taxonomy terms overview.
taxonomy_term_confirm_parents in modules/taxonomy/taxonomy.admin.inc
Form builder for the confirmation of multiple term parents.
template_preprocess_forums in modules/forum/forum.module
Process variables for forums.tpl.php
theme_book_admin_table in modules/book/book.admin.inc
Theme function for the book administration page form.
user_admin_account in modules/user/user.admin.inc
Form builder; User administration page.
user_edit_delete_submit in modules/user/user.pages.inc
Submit function for the 'Delete' button on the user edit form.
user_login_block in modules/user/user.module
_update_no_data in modules/update/update.module
Prints a warning message when there is no data about available updates.

Code

includes/common.inc, line 255

<?php
function drupal_get_destination() {
  if (isset($_REQUEST['destination'])) {
    return 'destination='. urlencode($_REQUEST['destination']);
  }
  else {
    // Use $_GET here to retrieve the original path in source form.
    $path = isset($_GET['q']) ? $_GET['q'] : '';
    $query = drupal_query_string_encode($_GET, array('q'));
    if ($query != '') {
      $path .= '?'. $query;
    }
    return 'destination='. urlencode($path);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.