The variable_get variable names do not match the names stored in the database.
/**
* Returns the correct link target ("_blank" or "") depending on
* global settings and, if enabled, user preference settings. The
* target may depend on whether the link is internal or external.
* If that is the case, and the optional link_spec parameter is not
* supplied, an external link will be assumed.
*/
function links_get_goto_target($link_spec=0) {
global $user;
$t_value = intval(variable_get("links_target_default", 0));
if (intval(variable_get("links_target_user", 0))) {
if (isset($user->links_target_new)) {
$t_value = intval($user->links_target_new);
}
}
switch ($t_value) {
case 1:
$target = '_blank';
break;
case 2:
$external = links_is_external($link_spec);
$target = $external ? '_blank' : '';
break;
default:
$target = '';
}
return $target;
}
The links_target_default is actually named links_target in the variable table and the links_target_user is actually links_target_is_user_specific in the variable table. The function and variable table doesn't support the administration page either.
Link targets
These settings allow you to apply the attribute target="_blank" to cause links to open in a new browser window or tab. Using this setting will cause your pages not to validate under the XHTML standard, but will work with most browsers. There is some debate over whether using the target attribute is good design practice; Links leaves this choice up to the system administrator.
Open links in new window:
* Never
* All links
* External links only
Controls opening of new browser windows for links.
If I modify links_target_default to links_target the link opens in a new window if I select "All links". What needs to change to make it work with "External links only"?
Earnie
http://for-my-kids.com
Comments
Comment #1
Anonymous (not verified) commentedHere's a small patch set to fix this issue. Patch is attached
Earnie
http://for-my-kids.com
Comment #2
webchickPatch.
Comment #3
Anonymous (not verified) commentedI'm wondering if it would be better to use constants for the variable name argument to variable_get? The constants would be assigned in links.inc. The use of constants would prevent the need to update everywhere should the variable name change at anytime.
Earnie
P.S.: A version of this patch is being used at http://give-me-an-offer.com/offers which is a 4.7 version.