--- favorite_nodes_orig.module 2008-09-07 20:20:48.000000000 +0200 +++ favorite_nodes.module 2008-09-07 22:02:15.000000000 +0200 @@ -20,6 +20,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_TEASER', 'favorite_nodes_teaser'); /** * Implementation of hook_help(). @@ -282,21 +283,34 @@ function favorite_nodes_link($type, $node = null, $teaser = false) { global $user; $links = array(); - if ($type == 'node' && !$teaser) { + + if ($type == '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[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid); + if (!$teaser) { + $links[] = array('title' => t('add to favorites'), 'href' => 'favorite_nodes/add/'. $node->nid); + } + elseif ($teaser && variable_get('favorite_nodes_teaser', 0) == 1) { + $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); + if (!$teaser) { + $links[] = array('title' => t('in favorites')); + $links[] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid); + } + elseif ($teaser && variable_get('favorite_nodes_teaser', 0) == 1) { + $links[] = array('title' => t('in favorites')); + $links[] = array('title' => t('remove from favorites'), 'href' => 'favorite_nodes/delete/'. $node->nid); + } } } } } } + return $links; } @@ -342,6 +356,14 @@ '#default_value' => variable_get(FAVORITE_NODES_MENUS, 0), '#description' => t('Whether to show a menu item in the navigation block for each node type?'), ); + + $form[$set][FAVORITE_NODES_TEASER] = array( + '#type' => 'checkbox', + '#title' => t('Show in teaser'), + '#return_value' => 1, + '#default_value' => variable_get(FAVORITE_NODES_TEASER, 0), + '#description' => t('Whether to show in teaser or not?'), + );