How do you go to an overlay view within Drupal using drupal_goto? I want to redirect to a page with an overlay within code.  I have tried the following, which is the path in the URL.

 drupal_goto('#overlay=admin/vendor/auth-stripe');


The path I want in overlay is admin/vendor/auth-stripe.  When I remove the #overlay= it works, but I want my user to see it in overlay mode.
You cannot pass a URL fragment into drupal_goto() like that or it will get escaped and won't work properly.

From the drupal_goto() docs it says the second parameter is an array of $options that get sent through to the url() function.

Looking at the url() function docs shows that one of the allowed $options is:


  'fragment': A fragment identifier (named anchor) to append to the URL. Do not include the leading '#' character.


So you should be able to do this:

drupal_goto(current_path(), array('fragment' =&gt; 'overlay=admin/vendor/auth-stripe'));


Note the use of current_path() as the path so that the page under the overlay will be the on the user was previously on.

If you didn't want that, then this would use the front page instead of the current page (because if you pass an empty path into the url() function it uses the front page as a default):

drupal_goto('', array('fragment' =&gt; 'overlay=admin/vendor/auth-stripe'));