--- favorite_nodes.module-orig	2008-09-20 19:49:22.000000000 -0700
+++ favorite_nodes.module	2009-01-03 14:02:37.000000000 -0800
@@ -12,6 +12,7 @@ define('FAVORITE_NODES_PAGE_LIMIT',     
 define('FAVORITE_NODES_PROFILE_LIMIT',   'favorite_nodes_profile_limit');
 define('FAVORITE_NODES_PAGE_TYPE',       'favorite_nodes_page_type');
 define('FAVORITE_NODES_MENUS',           'favorite_nodes_menu');
+define('FAVORITE_NODES_SHOWLINK',        'favorite_nodes_showlink');
 
 // View favorites in user info or in a menu_local_task of user page ?
 define('FAVORITE_NODES_VIEW_IN_PROFILE',  'favorite_nodes_view_in_profile');
@@ -138,26 +139,7 @@ function _node_types_natcasesort() {
 function favorite_nodes_user($op, &$edit, &$user, $category = null) {
   switch ($op) {
     case 'view':
-      if (variable_get(FAVORITE_NODES_VIEW_IN_PROFILE, 1)) {
-        $fav_list = array();
-        foreach (_node_types_natcasesort() as $type) {
-          if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
-            $uid = intval($user->uid);
-            $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
-            $items = array();
-            if (!empty($favorites)) {
-              foreach ($favorites as $favorite) {
-                $items[] = l($favorite->title, "node/$favorite->nid");
-              }
-            }
-            $fav_list[] = array(
-              'title' => l($type->name, "favorite_nodes/view/$user->uid/$type->type"),
-              'value' => theme('item_list', $items),
-            );
-          }
-        }
-        return array(t('Favorites') => $fav_list);
-      }
+      return theme('favorite_nodes_user_page', $user);
       break;
 
     case 'delete':
@@ -167,6 +149,30 @@ function favorite_nodes_user($op, &$edit
 }
 
 /**
+ * List of favorite enabled content types with favorites
+ */
+function theme_favorite_nodes_user_page($account) {
+  $fav_list = array();
+  foreach (_node_types_natcasesort() as $type) {
+    if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) {
+      $uid = intval($account->uid);
+      $favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5));
+      $items = array();
+      if (!empty($favorites)) {
+        foreach ($favorites as $favorite) {
+          $items[] = l($favorite->title, "node/$favorite->nid");
+        }
+      }
+      $fav_list[] = array(
+        'title' => $items ? l($type->name, "favorite_nodes/view/$account->uid/$type->type") : $type->name,
+        'value' => theme('item_list', $items),
+      );
+    }
+  }
+  return array(t('Favorites') => $fav_list);
+}
+
+/**
  * Implementation of hook_nodeapi().
  */
 function favorite_nodes_nodeapi(&$node, $op, $teaser = null, $page = null) {
@@ -281,17 +287,29 @@ function favorite_nodes_block($op = 'lis
 function favorite_nodes_link($type, $node = null, $teaser = false) {
   global $user;
   $links = array();
-  if ($type == 'node' && !$teaser) {
+  if ($type == 'node' && !$teaser && variable_get(FAVORITE_NODES_SHOWLINK, 1)) {
     if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) {
       if (user_access(FAVORITE_NODES_PERM_ADD)) {
-        if (!_favorite_nodes_check($node->nid)) {
-          $links['favorite_nodes_add'] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid, 'attributes' => array('class' => 'favorites add'));
-        }
-        else {
-          if (user_access(FAVORITE_NODES_PERM_VIEW)) {
-            $links['favorite_nodes_in'] = array('title' => t('in favorites'));
-            $links['favorite_nodes_remove'] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid, 'attributes' => array('class' => 'favorites remove'));
-          }
+        $links = theme('favorite_nodes_links', $node);
+      }
+    }
+  }
+  return $links;
+}
+
+/**
+ * Allow theming of links().
+ */
+function theme_favorite_nodes_links($node) {
+  if (variable_get(FAVORITE_NODES_NODE_TYPE . $node->type, 0)) {
+    if (user_access(FAVORITE_NODES_PERM_ADD)) {
+      if (!_favorite_nodes_check($node->nid)) {
+        $links['favorite_nodes_add'] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid, 'attributes' => array('class' => 'favorites add'));
+      }
+      else {
+        if (user_access(FAVORITE_NODES_PERM_VIEW)) {
+          $links['favorite_nodes_in'] = array('title' => t('in favorites'));
+          $links['favorite_nodes_remove'] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid, 'attributes' => array('class' => 'favorites remove'));
         }
       }
     }
@@ -353,6 +371,14 @@ function favorite_nodes_settings() {
     '#description' => t('Whether to show a menu item in the navigation block for each node type?'),
   );
 
+  $form[$set][FAVORITE_NODES_SHOWLINK] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display Favorite Node options as links'),
+    '#return_value' => 1,
+    '#default_value' => variable_get(FAVORITE_NODES_SHOWLINK, 1),
+    '#description' => t('Whether to show link items in the node view?'),
+  );
+
   $set = 'types';
   $form[$set] = array(
     '#type' => 'fieldset',
