Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1: Fix bug in term reference tree display. #2

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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