You are here

function theme_service_links_build_link in Service links 6

Same name and namespace in other branches
  1. 5 service_links.module \theme_service_links_build_link()
  2. 6.2 service_links.theme.inc \theme_service_links_build_link()
  3. 7.2 service_links.theme.inc \theme_service_links_build_link()
1 theme call to theme_service_links_build_link()
service_links_render in ./service_links.module
Function that renders the service links. This is the function themers want to call to insert the service links.

File

./service_links.module, line 453
Current Maintainer: Fabio Mucciante aka TheCrow Original Author: Fredrik Jonsson fredrik at combonet dot se A module that adds Digg, del.icio.us, reddit, Technorati etc. links to nodes.

Code

function theme_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') . '/images/' . $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') . '/images/' . $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') . '/images/' . $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') . '/images/' . $image . '" alt="' . $text . '" /> ' . $text . '</a>';
        break;
    }
  }
  return $link;
}