Slightly broken/typo in creating link from the node display back to the term page

dman - October 19, 2008 - 01:02
Project:Taxonomy Image
Version:6.x-1.x-dev
Component:Contrib Node Display
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

This looks like a minor oversight.
You wouldn't have noticed it when using your own theme functions, but the link back from nodes with embedded images was not correctly finding the term/n page.

Changed from the unavailable $tid to $term->tid

diff -u -p -r1.1.4.5 taxonomy_image_node_display.module
--- taxonomy_image/contributed/taxonomy_image_node_display/taxonomy_image_node_display.module 1 Oct 2008 20:17:10 -0000 1.1.4.5
+++ taxonomy_image/contributed/taxonomy_image_node_display/taxonomy_image_node_display.module 19 Oct 2008 00:55:41 -0000
@@ -53,7 +53,7 @@ function taxonomy_image_node_display_the
  * Theming function to allow overrides at theme level
  */
function theme_taxonomy_image_display($image, $term) {
-  return l($image, 'taxonomy/term/'. $tid, array('html' => TRUE, 'attributes' => array('class' => 'taxonomy_image_links')));
+  return l($image, 'taxonomy/term/'. $term->tid, array('html' => TRUE, 'attributes' => array('class' => 'taxonomy_image_links')));
}

/**

AttachmentSize
taxonomy_image-link_from_node_display_correction-20081019.patch1.07 KB

#1

NancyDru - October 20, 2008 - 13:54
Status:needs review» fixed

Hmm, interesting. The 5.x version was already correct. Thanks, dman.

#2

tedlchen - October 26, 2008 - 13:45

I just hit this same bug right now, and looked at it before I saw this post. If you're going to do the above, you'll also need to fix the caller,

function taxonomy_image_node_display_nodeapi(&$node, $o
...

- foreach ($node->taxonomy as $tid => $term) {
+ foreach ($node->taxonomy as $term) {
-        $image = taxonomy_image_display($tid);
+        $image = taxonomy_image_display($term->tid);

        if ($view_link && $image) {
          $image = theme('taxonomy_image_display', $image, $term);

#3

NancyDru - October 26, 2008 - 18:26

@tedichen: The foreach should pick up the tid as the array key, which is how the taxonomy method of the node object is built. Have you seen it constructed differently?

#4

Anonymous (not verified) - November 9, 2008 - 18:32
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.