instead same window... I don't want to move my visitors away from the site.

Comments

apsivam’s picture

Status: Active » Postponed

we will plan something for this in the next release

Anonymous’s picture

that would be cool!

aaron stanush’s picture

This would be a fantastic addition. Could be simple as a check box on the module configuration page.

adamcarsonb’s picture

Category: support » feature
StatusFileSize
new3.48 KB

Here's how I modified this module to open each link in a new window.
In service_links.module, I modified the lines ending in //ACB. I added a 'target' parameter in the attributes array for the link. Hope this helps, and I hope I've done it right.

if ($nodelink) {
switch (variable_get('service_links_style', 1)) {
case 1:
$link = array(
'title' => $text,
'href' => $url,
'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank') //ACB
);
break;
case 2:
$link = array(
'title' => 'Only local images are allowed.',
'href' => $url,
'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank'), //ACB
'html' => TRUE
);
break;
case 3:
$link = array(
'title' => 'Only local images are allowed. '. $text,
'href' => $url,
'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank'), //ACB
'html' => TRUE
);
break;
}
}

matt@antinomia’s picture

Version: 5.x-1.0 » 5.x-1.x-dev
Status: Postponed » Needs review
StatusFileSize
new2.61 KB

Attached is a patch that makes use of the external links filter module to force service links to open in a new window (applies target="_blank" via jQuery to ensure W3C compliancy -- target="_blank" is not compliant. Please review.

vesapalmu’s picture

While waiting for this feature you can override theme_service_links_build_link in your own theme. This means you don't have to hack the module at all. With phptemplate and current 5.x release of Service Links add this to your template.php:

function phptemplate_service_links_build_link($text, $url, $title, $image, $nodelink) {
  global $base_path;

  if ($nodelink) {
    switch (variable_get('service_links_style', 1)) {
      case 1:
        $link = array(
          'title' => $text,
          'href' => $url,
          'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank')
        );
        break;
      case 2:
        $link = array(
          'title' => '<img src="'. $base_path . drupal_get_path('module', 'service_links') .'/'. $image .'" alt="'. $text .'" />',
          'href' => $url,
          'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank'),
          'html' => TRUE
        );
        break;
      case 3:
        $link = array(
          'title' => '<img src="'. $base_path . drupal_get_path('module', 'service_links') .'/'. $image .'" alt="'. $text .'" /> '. $text,
          'href' => $url,
          'attributes' => array('title' => $title, 'rel' => 'nofollow', 'target' => '_blank'),
          'html' => TRUE
        );
        break;
    }
  }
  else {
    switch (variable_get('service_links_style', 1)) {
      case 1:
        $link = '<a href="'. check_url($url) .'" title="'. $title .'" rel="nofollow" target="_blank">'. $text .'</a>';
        break;
      case 2:
        $link = '<a href="'. check_url($url) .'" title="'. $title .'" rel="nofollow" target="_blank"><img src="'. $base_path . drupal_get_path('module', 'service_links') .'/'. $image .'" alt="'. $text .'" /></a>';
        break;
      case 3:
        $link = '<a href="'. check_url($url) .'" title="'. $title .'" rel="nofollow" target="_blank"><img src="'. $base_path . drupal_get_path('module', 'service_links') .'/'. $image .'" alt="'. $text .'" /> '. $text .'</a>';
        break;
    }
  }

  return $link;
}
marlandc’s picture

I want to follow up with #4, this worked for me. The bookmarks open up in a new window. Thanks!

#5 and #6 may work as well, I just applied the first answer.

TheCrow’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

ingacosta’s picture

Version: 5.x-1.x-dev » 6.x-1.0
Status: Closed (fixed) » Active

I have 6.x 1.0 version of this module. It open the link in the same window. How can I open it in another window?

rkdeveloper’s picture

its not yet fixed in 6.x-1.0 also. if somebody is still looking for some fix for this go for #6 it works for me.

charos’s picture

For the record :It is included in 6.x-2.x-dev (noting to clarify it, since the Version has changed few times in this issue)

TheCrow’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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