It would be nice if the notification form for subscribing to taxonomy terms showed the hierarchy of the taxonomy terms, either with CSS classes that could be targeted (ie, "depth1", "depth2", etc), or by pre-pending hyphens in front of the term, like is done in many other places. Ideally the admin could select which (or none) to use from the Tag Subscription settings.

Comments

brian_c’s picture

Instead of attempting to modify Notifications, I've added code to lookup the hierarchy structure and add (hyphenated) indenting in our theme layer, with the following in template.php:

// implementation of theme_notifications_form_table()
function MYTHEME_notifications_form_table($element) {

  // test for the vocabulary name here
  if( $element['#title'] == 'Categories' ){

    // get category taxonomy tree, and re-index by TID for quick lookup
    $rawtree = taxonomy_get_tree( CATEGORIES_TAXONOMY_ID ); // replace with actual vocabulary ID#, or define a constant
    $tree = array();
    foreach( $rawtree as $item ){
      $tree[ $item->tid ] = $item;
    }
    
    // scan through title array, adding hyphens to show depth
    foreach( $element['title'] as $tid => $title ){
      if( !empty( $tree[ $tid ]->depth ) ){
        $element['title'][$tid]['#value'] = str_repeat( '-', $tree[ $tid ]->depth ) . $title['#value'];
      }
    }
  }
  
  // pass back to default function
  return theme_notifications_form_table($element);
}

This was only written to handle a single vocabulary, but would be easy enough to adapt to multiple vocabularies.

sly5’s picture

voting!