You are here

function service_links_link in Service links 5

Same name and namespace in other branches
  1. 6.2 service_links.module \service_links_link()
  2. 6 service_links.module \service_links_link()

Implementation of hook_link().

File

./service_links.module, line 283
Mantainer: 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 service_links_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == 'node') {
    switch (variable_get('service_links_in_links', 0)) {
      case 0:
        $show_links = FALSE;
        break;
      case 1:
        $show_links = $teaser ? TRUE : FALSE;
        break;
      case 2:
        $show_links = $teaser ? FALSE : TRUE;
        break;
      case 3:
        $show_links = TRUE;
        break;
      default:
        $show_links = FALSE;
    }
    if (_service_links_show($node->type, $node->nid) && $show_links && user_access('use service links')) {
      $links = service_links_render($node, TRUE);
    }
  }
  return $links;
}