taxonomy_menu is cool, but I like the way taxonomy_context shows you the description of the current term. I made a little change to the taxonomy_menu_page() function that presents the term description (as set up during taxonomy config, and allowed to contain HTML tags) as a message (appears just below the title at least in the themes I care about), just like taxonomy_context seems to.

I don't really know what I'm doing, just hacking away, but this seems like it might be of general interest.

function taxonomy_menu_page() {
  if (arg(2)) {
    $arguments = explode("/", $_GET["q"]);
    $main_tid = check_query(array_pop($arguments));
  }
  else {
    $main_tid = 0;
  }
  //PDS start
  $term  = taxonomy_get_term($main_tid);
  if ($term->description) { 
    drupal_set_message($term->description,"term");
  }
  //PDS end

Comments

jonbob’s picture

This won't go into the 4.4 version, but is a possibility for HEAD. Does this need to be an optional setting, or is it always safe to show the description?

Also, what is the right way to display the description? Using drupal_set_message() doesn't feel right here. Just a paragraph tag enclosing it?

Eric Scouten’s picture

Assigned: Unassigned » Eric Scouten
StatusFileSize
new1.82 KB

See attached patch. I needed this feature for one of my sites. :-)

This makes it an option with the default set to off (existing behavior). I put the description in a <div class="description">.

morbus iff’s picture

I'll +1 this with the following caveats:

  • I prefer "taxonomy_menu_description" to just "description" for a class.
  • "then when" is the evilest bit of language EVAR. Revise.

For the language revisions, perhaps:

  • If checked, a term's description will be displayed at the top of the node listing page.
  • If checked, all nodes belonging to a selected term's subterms are also displayed.
Eric Scouten’s picture

StatusFileSize
new3.58 KB

New patch that addresses Morbus' concerns.

Eric Scouten’s picture

See also http://drupal.org/node/16055, which includes these changes and also adds an option to allow the listing of child terms.

Eric Scouten’s picture

This patch has languished for months. Any hope of seeing it committed?

brmassa’s picture

Version: » master
Status: Needs review » Closed (fixed)