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()

▾ 9 functions call drupal_get_destination()

comment_admin_overview in modules/comment.module
Menu callback; present an administrative comment listing.
node_admin_nodes in modules/node.module
Menu callback: content administration.
node_page in modules/node.module
Menu callback; dispatches control to the appropriate operation handler.
path_overview in modules/path.module
Return a listing of all defined URL aliases.
statistics_top_visitors in modules/statistics.module
Menu callback; presents the "top visitors" page.
taxonomy_overview_terms in modules/taxonomy.module
Display a tree of all the terms in a vocabulary, with options to edit each one.
user_block in modules/user.module
Implementation of hook_block().
user_edit in modules/user.module
user_login in modules/user.module

Code

includes/common.inc, line 206

<?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.