API page: http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_go...

Describe the problem you have found:

However you may override that behavior by setting a destination in either the $_REQUEST-array (i.e. by using the query string of an URI) This is used to direct the user back to the proper page after completing a form. For example, after editing a post...

The sentence says "in either", and then goes on to give one place to set the destination. Two problems:

1. I think an explanation of the $_REQUEST-array is warranted, or at least a pointer to further documentation about $_REQUEST.

2. What is the other alternative?

Comments

jhodgdon’s picture

Title: Documentation problem with drupal_goto » drupal_goto doc says "either" but presents only one alternative

Hm. No idea here... someone will need to investigate. Thanks for reporting!

drewish’s picture

Version: 7.x-dev » 8.x-dev
Status: Active » Needs review
StatusFileSize
new1.5 KB
jhodgdon’s picture

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

Temporarily setting back to 7.x so the test bot will hopefully kick off. It looks like we aren't testing d8 yet.

jhodgdon’s picture

Status: Needs review » Needs work

That aside... a few issues with this patch:
a)

+ * If a destination was specified in current request's URI, i.e.
+ * $_GET['destination'], then it will override the $path and $options values

1. in current ==> in the current
2. URI, i.e. ==> URI, i.e., (punctuate i.e. as if it was "that is", which is what it means -- must be followed by a comma)

b) The code example doesn't seem to use $destination after setting it, so I'm not getting what it does at first glance?

drewish’s picture

Status: Needs work » Needs review
StatusFileSize
new1.51 KB

How's this look?

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good! Please commit to 7 and 8.

jhodgdon’s picture

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

Needs to go to d8 and then d7

dries’s picture

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

Committed to 8.x. Moving back to 7.x.

bfroehle’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs work

This was already committed to 8.x-dev, but it needs some work. The sample code is not valid:

$destination = array('destination' => "node/$node->nid");
l(t('Log in'), array('@login' => url('user/login', array('query' => array($destination)))));

Do you mean?

$query = array('destination' => "node/$node->nid");
l(t('Log in'), 'user/login', array('query' => $query));

Or perhaps even better

l(t('Log in'), 'user/login', array('query' => drupal_get_destination()));
jhodgdon’s picture

good idea. Sorry for missing that in my previous review.

drewish’s picture

drupal_get_destination() has some odd behaviors that distracted from the explanation so I chose not to use it. It also obscures the data format, I suppose as my "example" demonstrates.

jhodgdon’s picture

I agree, let's not use that function, but the example is still wrong I think?

bfroehle’s picture

So, shall we use:

$query = array('destination' => "node/$node->nid");
l(t('Log in'), 'user/login', array('query' => $query));
jhodgdon’s picture

That example looks fine to me. Since we're trying to stay mostly within 80 character lines in docblocks, having it be two lines like that is probably good; if it was just code, I'd probably say to just put it all in one line.

Needs a patch...

pillarsdotnet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.14 KB

Follow-up patch for 8.x.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

OK, looks good! Let's get this into 8.x. Then we need to make a patch like #5, but with the example in #15, for 7.x. So please mark "patch / to be ported / 7.x". Thanks!

pillarsdotnet’s picture

Issue tags: +Needs backport to D7

Tag.

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 8.x.

Marking 7.x/to be ported.

(Btw, Jennifer, I always really appreciate those helpful instructions at the end of all your sign-offs! :))

pillarsdotnet’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new1.92 KB

Patch for 7.x

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good - let's get this into D7. Thanks!

Originally reported problem does not exist in D6, so this should be good.

pillarsdotnet’s picture

Status: Reviewed & tested by the community » Fixed

Committed by Webchick:

bobvin@bowie:~/d8$ git log
commit 8a9f7b6d4a75e52327180ab3b10d2fd73471469b
Author: webchick <webchick@24967.no-reply.drupal.org>
Date:   Wed Jun 1 01:47:29 2011 -0700

    Issue #1079214 follow-up by pillarsdotnet: Adjustment to drupal_goto() doc example.

Status: Fixed » Closed (fixed)
Issue tags: -Needs backport to D7

Automatically closed -- issue fixed for 2 weeks with no activity.