overriding favorite nodes links

  1. /**
  2.  * Implementation of hook_links().
  3.  */
  4. function favorite_nodes_link($type, $node = null, $teaser = false) {
  5.   global $user;
  6.   $links = array();
  7.   if ($type == 'node' && !$teaser) {
  8.     if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) {
  9.       if (user_access(FAVORITE_NODES_PERM_ADD)) {
  10.         if (!_favorite_nodes_check($node->nid)) {
  11.           $links[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid, 'class' => 'fav');
  12.         }
  13.         else {
  14.           if (user_access(FAVORITE_NODES_PERM_VIEW)) {
  15.             $links[] = array('title' => t('in favorites'));
  16.             $links[] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid);
  17.           }
  18.         }
  19.       }
  20.     }
  21.   }
  22.   return $links;
  23. }