Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Would like to have the option to assign "open links in new window" if possible. Great module, btw!
Comment | File | Size | Author |
---|---|---|---|
#2 | open_links_in_new_window-1271874-2.patch | 426 bytes | wolmi |
Comments
Comment #1
q0rban CreditAttribution: q0rban commentedHey there! As you can see on the project page, I recommend the External module for opening these links in a new window. :)
Comment #2
wolmi CreditAttribution: wolmi commentedI think this patch can resolve the problem, better than install a new module without drupal 7 release.
Comment #3
q0rban CreditAttribution: q0rban commentedWolmi, thanks for the patch, but I'm sorry, I will not be adding target="_blank". It is not valid html. External module is a very simple module that just adds some js to the page. You could look at that js and do something similar. :)
Comment #4
q0rban CreditAttribution: q0rban commentedAlternately, you can use a custom theme function in your theme to add target in the way you want. :)
Comment #5
rojesaga CreditAttribution: rojesaga commentedThanks for the unoffical patch, works great for me. Is just I was looking for. And yes, is better than install a new module that is not ported to D7
Comment #6
defconjuan CreditAttribution: defconjuan commentedThe following solution DOES NOT require adding the
external
module; DOES NOT hack thefollow
module; and is valid HTML5. We basically use a theme function override to override the functionality of follow'stheme_follow_link
function.Say you're using a theme called
facepalm
.Step 1
Add the following code to the bottom of facepalm's
template.php
file:Step 2
Add the following jQuery-dependent JavaScript to facepalm's
html.tpl.php
somewhere before the closing</head>
tag:Notes
'target' => '_blank',
instead of'data-popup' => 'true',
. Don't.target="_blank"
is not valid HTML5. But, if you did this, you would NOT require Step 2 or jQuery.data-popup="true"
to any link in your site and it will now open in a new window.