diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-04 15:10:09 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-04 15:10:09 +0000 |
commit | 6af0c30d14cc8a49cbea003b0a9d4502560a1cc4 (patch) | |
tree | 697e863f5e53692e30e80020d52a2ad01a46aa80 /modules/taxonomy | |
parent | 325e51de3c553e24a35ba6eb0333a5b5aef150ef (diff) | |
download | brdo-6af0c30d14cc8a49cbea003b0a9d4502560a1cc4.tar.gz brdo-6af0c30d14cc8a49cbea003b0a9d4502560a1cc4.tar.bz2 |
#180719 by sun and JirkaRybka: standardize on displaying the term description on term pages and feeds, but only if there was one term, not more
Diffstat (limited to 'modules/taxonomy')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 3 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.pages.inc | 37 |
2 files changed, 36 insertions, 4 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index ff7283dd7..f5140ed1f 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -21,6 +21,9 @@ function taxonomy_theme() { 'taxonomy_term_select' => array( 'arguments' => array('element' => NULL), ), + 'taxonomy_term_page' => array( + 'arguments' => array('tids' => array(), 'result' => NULL), + ), ); } diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc index 4f86441e9..4a4b9339a 100644 --- a/modules/taxonomy/taxonomy.pages.inc +++ b/modules/taxonomy/taxonomy.pages.inc @@ -3,7 +3,7 @@ /** * @file - * Administrative page callbacks for the taxonomy module. + * Page callbacks for the taxonomy module. */ /** @@ -41,16 +41,20 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { $breadcrumb = array_reverse($breadcrumb); drupal_set_breadcrumb($breadcrumb); - $output = taxonomy_render_nodes(taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); + $output = theme('taxonomy_term_page', $tids, taxonomy_select_nodes($tids, $terms['operator'], $depth, TRUE)); drupal_add_feed(url('taxonomy/term/'. $str_tids .'/'. $depth .'/feed'), 'RSS - '. $title); return $output; break; case 'feed': - $term = taxonomy_get_term($tids[0]); $channel['link'] = url('taxonomy/term/'. $str_tids .'/'. $depth, array('absolute' => TRUE)); $channel['title'] = variable_get('site_name', 'Drupal') .' - '. $title; - $channel['description'] = $term->description; + // Only display the description if we have a single term, to avoid clutter and confusion. + if (count($tids) == 1) { + $term = taxonomy_get_term($tids[0]); + // HTML will be removed from feed description, so no need to filter here. + $channel['description'] = $term->description; + } $result = taxonomy_select_nodes($tids, $terms['operator'], $depth, FALSE); @@ -60,6 +64,7 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { node_feed($items, $channel); break; + default: drupal_not_found(); } @@ -71,6 +76,30 @@ function taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page') { } /** + * Render a taxonomy term page HTML output. + * + * @param $tids + * An array of term ids. + * @param $result + * A pager_query() result, such as that performed by taxonomy_select_nodes(). + */ +function theme_taxonomy_term_page($tids, $result) { + $output = ''; + + // Only display the description if we have a single term, to avoid clutter and confusion. + if (count($tids) == 1) { + $term = taxonomy_get_term($tids[0]); + $output .= '<div class="taxonomy-term-description">'; + $output .= filter_xss_admin($term->description); + $output .= '</div>'; + } + + $output .= taxonomy_render_nodes($result); + + return $output; +} + +/** * Helper function for autocompletion */ function taxonomy_autocomplete($vid, $string = '') { |