You are here

function fb_example_link in Drupal for Facebook 6.3

Implements hook_link().

Add an XFBML like button to all node pages. The button will appear next to other node links, such as "add new comment".

File

contrib/fb_example.module, line 19
Example customizations to modules/fb.

Code

function fb_example_link($type, $object, $teaser = FALSE) {
  if ($type == 'node' && !$teaser) {
    $items = array();

    // Switch to control this behavior.
    if (variable_get('fb_example_link_add_like', TRUE)) {
      $url = fb_scrub_urls(url('node/' . $object->nid, array(
        'absolute' => TRUE,
      )));
      $items['dff_like'] = array(
        'title' => "<fb:like send=\"true\" ref=\"node/{$object->nid}\" href={$url}></fb:like>",
        'html' => TRUE,
      );
    }
    return $items;
  }
}