notice: Undefined property: stdClass::$title in image.module
unjello - November 1, 2009 - 14:44
| Project: | Image |
| Version: | 6.x-1.0-beta3 |
| Component: | image.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
After attaching an image to a Story and creating news listing in Views2 I got following messages in lines 702 and 703. Quick workaround attached.
| Attachment | Size |
|---|---|
| image.module.patch | 701 bytes |

#1
Hmm, we should never be getting there without a node title!
That workaround works, but the proper fix is to get a node title into that $node object.
You're using the attached image field, right?
The best fix I think would be at this point:
$result = db_query("SELECT nid, iid FROM {image_attach} WHERE nid IN (" . $nids_string . ") ORDER BY weight");add a JOIN to {node} there and get the title.
That necessitates a change in the storage in $attached_images, as we're no longer just stashing a flat array of nids.
Come to think of it, we could move the call to image_load() into pre_render() too -- that might save a query or two if the same images are attached to different stories. That then means that $attached_images is an array of pseudo-$node objects.
So quite a big patch...will work on it later :)