show CKK imagefield in bubble
franskuipers - April 9, 2008 - 11:17
| Project: | Timeline |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Description
I needed to show the CCK imagefield of a node into the bubble. This patch is doing just that. But the code needs some review. I don't know if this is the most efficient method to do it.
What I do now is:
- test if there are CCK fields in this node type
- if yes, is the field type image?
- if yes, give the image to the timeline api
Only the first found image is displayed, no size adjustments are made.
I have tried to do it with adding the imagefield into the fields of views, but the $view->fields('queryname') is not returned in the 'item' array.
| Attachment | Size |
|---|---|
| timeline-image-1.patch | 2.42 KB |

#1
The patch works, but there should be a way to do this without running directly the SQL commands.
I spent a couple of hours trying to come up with a cleaner solution; these are some of the things I tried (all in the function timeline_data):
If I add the CCK imagefield into the view, I get the 'fid' number (file id) in the bubble instead of the image. It should be possible to run content_format:
<?php$body_value = content_format('field_theimage',$node->field_theimage[0],'theimagehandler')
?>
which gives you the image, formatted according to the handler you specify. However, I haven't figured out a clean way to get just the field name (content_format's first parameter) from $view->field.
Another idea is to use node_view:
<?php$node->teaser = node_view($node,$teasers,FALSE,$links);
?>
This formats the node as a teaser, and displays it in the bubble as part of the $body_value. In this case, the view should only have two fields, and the event title appears twice (which can be fixed with CSS).
I thought I'd toss these ideas to see if we could come up with a more efficient way to handle imagefields in the timeline.
#2
For Drupal 6 I've moved to an entirely views based model, and allowed for any number of fields to be displayed in the bubble. To display an imagefield you'll simply need to add the imagefield to the view.
I'm changing the version of this issue to HEAD and setting the status to 'fixed'. I don't have any plans to push theses changes back down into the Drupal 5 branch.
#3
Automatically closed -- issue fixed for two weeks with no activity.
#4
Can we open this thread?
I don't have the option to upgrade to version 6 due to some other modules I am using and I would love to see more work done on getting cck fields into the timeline bubble.
Frans,
Do you think there is a way to do this, building on your patch and somnoliento's?
I can help if need be.
#5
If we are going to reopen this then moving this back to D5 version and the status of the patch in #1.
#6
This issue seems to be completely inactive. And there is no maintainer for the D5 version anymore. I'm not willing to support the D5 version, sorry. Please try newest version of timeline.