Posted by roo on July 25, 2008 at 1:48am
4 followers
| Project: | Duration |
| Version: | 6.x-1.0-rc1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi, I am using views in drupal 6 and Duration.
I cannot get durations to appear in table formats for views. It just shows up blank. Can you please have a look at this asap as it means duration is pretty much useless for me as the table views are used extensively on my site.
Thanks,
Roo
| Attachment | Size |
|---|---|
| duration doesnt display.JPG | 7.79 KB |
Comments
#1
Yes, I can confirm this...
#2
I found out that the views module - when loading a view - calls hook_field with $op="sanitize" instead of $op="load". So nothing had been returned.
I'm not sure at all when to use "sanitize", "load" (depreciated, I think) or "validate".
The only thing I know is that the duration shows up well in table views after applying this patch.
Please review to finalize.
#3
As far as I remember, "sanitize" is called whenever (...before) the contents are being displayed. "load" is not deprecated, but is not called each time because of CCK's caching. I guess it would work with "sanitize" (in case the Duration object is not used for anything else than for displaying the duration), but whatever the solution, it should only be loaded once (therefore "code needs work" status).
Of course I could look up how we did it in filefield 6.x, but hey, I'm on vacation right now :-P
#4
As far as I could find out hook_field($op = 'load'..) is only called from CCK module. And the data will only be retrieved from cache when a node-related function is called. So views will never obtain the duration object.
Maybe it could be called additionally from a formatter function, if it doesn't yet exist at this point?
greetings,
sevi
#5
I reported this issue to CCK as #312825: hook_field($op='load', ...) not called in Views listings, because I think this is exactly what 'load' should be for. Let's see what the CCK maintainers think about this - until then, let's set the issue status to "postponed".
#6
Ok, KarenS suggested (in the issue linked above) to work around this by introducing a custom views handler (derived from the CCK handler, which I think is content_handler_field_multiple) because the real issue, calling hook_field() without a node object, is probably not worth solving. I agree that a custom views handler would be a good idea, and vastly preferable over implementing the 'sanitize' hook. So back to 'active' as issue status, because the patch won't go in at all in this form.
That's not to belittle the debugging work, which I imagine was the hardest part of solving this issue. Now that we know how to do it, the remaining code is the least of our problems. Next Wednesday, at latest.
#7
Fixed, will push out a release (rc2) right now.
#8
Automatically closed -- issue fixed for two weeks with no activity.