You are here

function theme_hs_content_taxonomy_row in Hierarchical Select 6.3

Theme function to output single row (lineage) of CT field

Giving levels different classes so some funny theming is possible: for example, different font size depending on level (like tagadelic)

1 theme call to theme_hs_content_taxonomy_row()
theme_hs_content_taxonomy_formatter_hierarchical in modules/hs_content_taxonomy.module
Theme function for HS Content Taxonomy formatters.

File

modules/hs_content_taxonomy.module, line 256
Implementation of the Hierarchical Select API for the Content Taxonomy module.

Code

function theme_hs_content_taxonomy_row($row, $type) {
  $separator = '<span class="hierarchical-select-item-separator">›</span>';
  $output = '';
  if (empty($row)) {
    return $output;
  }
  $items = array();
  foreach ($row as $level => $item) {
    $term = taxonomy_get_term($item['value']);
    _content_taxonomy_localize_term($term);
    $line = '<span class="lineage-item lineage-item-level-' . $level . '">';

    // Depending on which formatter is active, create links or use labels.
    switch ($type) {
      case 'hierarchical_links':
        $line .= l($term->name, taxonomy_term_path($term), array(
          'rel' => 'tag',
          'title' => $term->description,
        ));
        break;
      case 'hierarchical_text':
        $line .= $item['label'];
        break;
    }
    $line .= '</span>';
    $items[] = $line;
  }
  $output = implode($separator, $items);
  return $output;
}