--- favorite_nodes.module.orig 2008-12-20 13:30:40.000000000 -0500 +++ favorite_nodes.module 2008-12-20 13:36:09.000000000 -0500 @@ -12,6 +12,7 @@ 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'); @@ -281,18 +282,10 @@ 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); } } } @@ -300,6 +293,25 @@ } /** + * Allow theming of links(). + */ +function theme_favorite_nodes_links($node) { + if (!_favorite_nodes_check($node->nid)) { + $links[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid); + } + 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; +} + + + +/** * Settings page for this module. */ function favorite_nodes_settings() { @@ -353,6 +365,15 @@ '#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',