Skip to content

Commit

Permalink
Issue #1: Fix bug in term reference tree display.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugfolder committed Jul 13, 2023
1 parent 729a0f1 commit e2657ba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions term_reference_tree.widget.inc
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,14 @@ function _term_reference_tree_output_list_level(&$element, &$tree) {
$term = $taxonomy_term_info['load hook']($item['tid']);
// Do not output terms that do not exist.
if ($term) {
$uri = $taxonomy_term_info['uri callback']($term);
$uri['options']['html'] = TRUE;
$class = $item['selected'] ? 'selected' : 'unselected';
$output_fragment[$term->weight][$itemno] = '<li class="' . $class . '">';
if ($tokens_selected != '' && module_exists('token')) {
$replace = $item['selected'] ? $tokens_selected : $tokens_unselected;
$output_fragment[$term->weight][$itemno] .= token_replace($replace, array('term' => $term), array('clear' => TRUE));
}
else {
$output_fragment[$term->weight][$itemno] .= l(filter_xss(entity_label('taxonomy_term', $term)), $uri['path'], $uri['options']);
$output_fragment[$term->weight][$itemno] .= l(filter_xss(entity_label('taxonomy_term', $term)), $term->path['source'], array('html' => TRUE));
}
if (isset($item['children'])) {
$output_fragment[$term->weight][$itemno] .= _term_reference_tree_output_list_level($element, $item);
Expand All @@ -239,8 +237,8 @@ function _term_reference_tree_output_list_level(&$element, &$tree) {
}
}

// Using output fragments with weights as the array key
// should force this into current sort order once we sort the array.
// Using output fragments with weights as the array key should force this
// into current sort order once we sort the array.
if (isset($output_fragment)) {
ksort($output_fragment);
foreach ($output_fragment as $this_fragment) {
Expand Down

0 comments on commit e2657ba

Please sign in to comment.