Index: nat.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nat/nat.module,v retrieving revision 1.35 diff -u -r1.35 nat.module --- nat.module 10 Nov 2008 19:37:47 -0000 1.35 +++ nat.module 10 Feb 2009 21:31:31 -0000 @@ -56,9 +56,25 @@ 'page arguments' => array('nat_sync_form'), 'access arguments' => array('administer NAT configuration'), 'type' => MENU_LOCAL_TASK + ); + $items['taxonomy/term/%/nat'] = array( + 'title' => 'NAT for term', + 'page callback' => 'nat_tid_to_node', + 'page arguments' => array(2), + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, ); + return $items; +} - return $items; +function nat_tid_to_node($tid) { + $nids = array_keys(nat_get_nids(array($tid), FALSE)); + if (!empty($nids)) { + drupal_goto("node/$nids[0]"); + } + else { + drupal_goto("taxonomy/term/$tid"); + } } /** @@ -72,7 +88,7 @@ 'path' => drupal_get_path('module', 'nat') .'/includes', ); } - + /** * Implementation of hook_perm(). */