Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
overlay.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Apr 2010 at 11:21 UTC
Updated:
13 May 2015 at 17:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
casey commentedI agree.
Comment #2
dries commentedCommitted to CVS HEAD. Thanks.
Comment #4
Anonymous (not verified) commentedI have the same 'issue', but different situation, with internal links. With external links, there are checks to not overwrite the target if one exists. However, with internal links, the target attribute is always set to "_parent". I can see the desire to keep with the idea that if the link stays on the site, then open it in the same window. At the same time, if I want to open a link in a new window with target="_blank" why should overlay trump my wishes of how to handle the link.
Comment #5
Anonymous (not verified) commentedForgot to change status before
Comment #6
merilainen commentedI also want to use target="_blank" for a link when user is editing content. I don't want to use the same tab/window because they will lose their changes!
Comment #7
Yuri commentedI got the same need for using target="_blank" link in the overlay.
In my case i want to create the following link in the help text of a field:
<a href="/node/add" target="_blank">Create new node</a>because I don't want the user to lose the current node edit form while creating another node. (often used when trying to reference a node that does not yet exist)Comment #8
aiwata55 commentedI have the same need as Yuri. I want to add a button with Form API to a node edit form, wrapping the button with the prefix and suffix attributes with a tag with target="_blank", to open a node addition form in a new window / tab.
Comment #9
olofbokedal commentedI've also experienced this issue.
If the link is external, the target won't be overridden if it already has been set. I can't see why this couldn't be implemented for internal links as well.
Comment #11
olofbokedal commentedComment #12
olofbokedal commentedComment #14
olofbokedal commentedOk, seriously, my apologies.
Third time's the charm!
Comment #15
David_Rothstein commentedI didn't test it, but the patch looks good and makes sense. Just needs a quick reroll for Drupal 8...
Comment #16
james.williamsI've done some limited testing on it and it works :-)
Comment #17
olofbokedal commentedAnd here's the same patch for Drupal 8.
Comment #18
David_Rothstein commentedThis looks ready to go, for both Drupal 8 and Drupal 7.
A quick way to test it is to use the Field UI to add some help text to the body field on the node form (and have the text be something like
<a href="/node" target="_blank">Home</a>)... I tried that and confirmed that before the patch this link won't open in a new window, but with the patch it will.Comment #19
David_Rothstein commentedD'oh, just realized that the test scenario I came up with is almost the exact same thing Yuri said in #7... Well, it definitely works :)
Comment #20
catchThanks! Committed/pushed to 8.x. Moving to 7.x for backport.
Comment #21
albert volkman commentedD7 backport.
Comment #22
tim.plunkettFixing tag.
Comment #23
cedwards.rei commentedWhat needs happen to get this patch committed to core??
Comment #24
albert volkman commentedYou can help by doing a patch review!
http://drupal.org/patch/review
Comment #25
aspilicious commentedWhile testing this check if the overlay stays open after clearing the cache....
Comment #26
andyhu commented#21 works for me, look forward to see this patch committed to 7.x
Comment #27
amir simantov commentedHi. Patch in #21 does NOT work for me.
I am trying to add a link through Views actually, writing this code in the Header part of the view:
Overlay open in the same direction.
BTW, is was better if I could add destination parameter while opening in the SAME tab, but I couldn't find any documentation of how to do in a simple PHP snippet inside a view. The naive code might be something like this:
Any help - either for making it open in a new tab or to redirect back to the original URL - will be appreciated!
Thanks.
Comment #28
ar-jan commentedI've tested the patch in #21 with an internal link with target="_blank" in a field's help text, as described in #18 (which happens to be exactly my use case).
With the patch applied the link does open in a new window. Codewise the patch is the same as what was committed for D8, so I think this is reviewed and tested.
Comment #29
ar-jan commentedRe #27: I think you need to write the link like this:
api.drupal.org/api/drupal/includes!common.inc/function/l/7
Comment #30
wadmiraal commented+1 For this !
Why has it not been committed yet ? The backport patch is almost a year old :-).
Comment #31
David_Rothstein commentedCommitted to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/c9d2148
Comment #34
rob230 commentedIt seems that the patch only works for non-admin links, due to this condition:
if (this.isAdminLink(href))My requirement is that the user is adding a node, and in the description of one of the fields I want to let them add another type of node, but I don't want them to lose their progress in the current form. Therefore I give it a target of _blank, but because it's an admin link, the target is ignored and it gets opened in the overlay.
I don't know if anything has changed since the patch in 7.22, because it seems to me that #7 and #18 are exactly the same requirement I have and the patch that was committed (#21) does NOT resolve it.
I managed to solve this by adding the
overlay-excludeclass:This means all of the overlay-related code is skipped, and the link will simply be opened as normal, using whatever target you give it. Using the
overlay-excludeclass actually obviates the need for the fix in patch #21.Comment #35
lunk rat commentedRob230, thank you so much for sharing the info about
overlay-exclude, it solved my problem in a simple elegant way.