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

Issues with PHP 8+ #1

Closed
onyxnz opened this issue Jun 19, 2023 · 4 comments · Fixed by #2
Closed

Issues with PHP 8+ #1

onyxnz opened this issue Jun 19, 2023 · 4 comments · Fixed by #2

Comments

@onyxnz
Copy link

onyxnz commented Jun 19, 2023

Patch required for PHP 8+, applied to term_reference_tree.widget.inc ::

--- ~/Downloads/term_reference_tree/term_reference_tree.widget.inc
+++ ~/new/term_reference_tree/term_reference_tree.widget.inc
@@ -215,22 +215,21 @@
     $settings = $element['#display']['settings'];
     $tokens_selected = $settings['token_display_selected'];
     $tokens_unselected = ($settings['token_display_unselected'] != '') ? $settings['token_display_unselected'] : $tokens_selected;
-
     $taxonomy_term_info = entity_get_info('taxonomy_term');
     foreach ($tree['children'] as $itemno => &$item) {
-      $term = $taxonomy_term_info['load hook']($item['tid']);
+      $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 = (Array)$taxonomy_term_info['load hook']($term->tid);//should be $term->tid?
         $uri['options']['html'] = TRUE;
         $class = $item['selected'] ? 'selected' : 'unselected';
-        $output_fragment[$term->weight][$itemno] = '<li class="' . $class . '">';
+        $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)), $uri['path']['source'], $uri['options']);
         }
         if (isset($item['children'])) {
           $output_fragment[$term->weight][$itemno] .= _term_reference_tree_output_list_level($element, $item);
@onyxnz
Copy link
Author

onyxnz commented Jun 19, 2023

This fixes path issues, and changes I suspect made due to the architecture of BD vs D7, around taxonomy.

@bugfolder
Copy link
Collaborator

@onyxnz, can you submit a PR?

@onyxnz
Copy link
Author

onyxnz commented Jun 19, 2023

I'll give it a crack, mate. New to this PR stuff.

bugfolder added a commit that referenced this issue Jul 13, 2023
Issue #1: Fix bug in term reference tree display.
@bugfolder
Copy link
Collaborator

I've merged a PR into the dev branch that fixes the issue. Thanks @onyxnz for pointing out the problem & the suggested fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants