/**
 * Implementation of hook_links().
 */
function favorite_nodes_link($type, $node = null, $teaser = false) {
  global $user;
  $links = array();
  if ($type == 'node' && !$teaser) {
    if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) {
      if (user_access(FAVORITE_NODES_PERM_ADD)) {
        if (!_favorite_nodes_check($node->nid)) {
          $links[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid, 'class' => 'fav');
        }
        else {
          if (user_access(FAVORITE_NODES_PERM_VIEW)) {
            $links[] = array('title' => t('in favorites'));
            $links[] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid);
          }
        }
      }
    }
  }
  return $links;
}