You are here

function service_links_link in Service links 6.2

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

Implementation of hook_link().

File

./service_links.module, line 158
Adds social network links to the content.

Code

function service_links_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  if ($type == 'node') {
    switch (variable_get('service_links_in_links', SERVICE_LINKS_DISABLED)) {
      case SERVICE_LINKS_DISABLED:
        $show_links = FALSE;
        break;
      case SERVICE_LINKS_IN_TEASER:
        $show_links = $teaser ? TRUE : FALSE;
        break;
      case SERVICE_LINKS_IN_FULL:
        $show_links = $teaser ? FALSE : TRUE;
        break;
      case SERVICE_LINKS_IN_BOTH:
        $show_links = TRUE;
        break;
      default:
        $show_links = FALSE;
        break;
    }
    if (service_links_show($node) && $show_links && user_access('access service links')) {
      $links = service_links_render($node, TRUE);
    }
  }
  return $links;
}