I think this is reasonable =) Instead of tagadelic_tags_lists() having the output code in there, I propose moving that to a theme() function... something like this?

/**
 * API function that returns the tags of a node in fancy titled lists
 * @param $node. A node object.
 */
function tagadelic_tags_lists($node) {
  return theme('tagadelic_tags_lists', $node);
}

/**
 * Theming function that returns the tags of a node in fancy titled lists
 * @param $node. A node object.
 */
function theme_tagadelic_tags_lists($node) {
  if (is_array($node->tags)) {
    foreach($node->tags as $vid => $terms) {
      $vocabulary = taxonomy_get_vocabulary($vid);
      $title = l(t($vocabulary->name), "tagadelic/chunk/$vid");
      $items = array();
      foreach ($terms as $term) {
        $items[] = l($term->name, taxonomy_term_path($term), array('title' => t('view all posts tagged with "@tag"', array('@tag' => $term->name))));
      }
      $output .= theme('item_list', $items, $title);
    }
    return $output;
  }
}

Comments

janusman’s picture

Bump! Should I issue a patch??

Bèr Kessels’s picture

Status: Active » Closed (duplicate)