Index: taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.384 diff -u -r1.384 taxonomy.module --- taxonomy.module 2 Oct 2007 16:15:56 -0000 1.384 +++ taxonomy.module 4 Oct 2007 06:40:56 -0000 @@ -21,6 +21,9 @@ 'taxonomy_term_select' => array( 'arguments' => array('element' => NULL), ), + 'taxonomy_term_description' => array( + 'arguments' => array('tid' => '', 'name' => '', 'description' => ''), + ), ); } Index: taxonomy.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v retrieving revision 1.2 diff -u -r1.2 taxonomy.pages.inc --- taxonomy.pages.inc 27 Sep 2007 16:52:00 -0000 1.2 +++ taxonomy.pages.inc 4 Oct 2007 06:55:05 -0000 @@ -16,12 +16,13 @@ } if ($terms['tids']) { - $result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN ('. db_placeholders($terms['tids']) .')', 't', 'tid'), $terms['tids']); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.name, t.description FROM {term_data} t WHERE t.tid IN ('. db_placeholders($terms['tids']) .')', 't', 'tid'), $terms['tids']); $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to. $names = array(); while ($term = db_fetch_object($result)) { $tids[] = $term->tid; $names[] = $term->name; + $descriptions[] = $term->description; } if ($names) { @@ -40,7 +41,14 @@ $breadcrumbs = array_reverse($breadcrumbs); menu_set_location($breadcrumbs); - $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); + // Displaying term description makes only sense for a single term. + if (count($names) == 1) { + $output = theme('taxonomy_term_description', $tids[0], $names[0], $descriptions[0]); + } + else { + $output = ''; + } + $output .= taxonomy_render_nodes(taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'), 'RSS - '. $title); return $output; break; @@ -59,6 +67,7 @@ node_feed($items, $channel); break; + default: drupal_not_found(); } @@ -70,6 +79,20 @@ } /** + * Format a taxonomy term description on term page view. + * + * @param $tid + * A term id. + * @param $name + * A corresponding term name. + * @param $description + * A corresponding term description. + */ +function theme_taxonomy_term_description($tid, $name, $description) { + return check_markup($description, FILTER_FORMAT_DEFAULT, FALSE); +} + +/** * Helper function for autocompletion */ function taxonomy_autocomplete($vid, $string = '') {