You are here

function fb_social_like_link in Facebook social plugins integration 6

Implementation of hook_link

File

modules/fb_social_like/fb_social_like.module, line 162

Code

function fb_social_like_link($type, $object, $teaser = FALSE) {

  //only nodes are supported
  if ('node' != $type) {
    return;
  }

  // dont like unpublished nodes
  if (!$object->status) {
    return;
  }

  // if no widget on teasers return
  if ($teaser && !variable_get('fb_social_like_display_teasers', 1)) {
    return;
  }

  // widget is not to be displayed in the node links. return
  if (variable_get('fb_social_like_location', 0)) {
    return;
  }

  // good to go
  $links = array();
  if ($type == 'node' && fb_social_like_type($object->type)) {
    $links['fb_social_like'] = array(
      'title' => theme('fb_social_like_widget', fb_social_url('node/' . $object->nid)),
      'html' => TRUE,
    );
  }
  return $links;
}