Closed (fixed)
Project:
Duration
Version:
6.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2008 at 01:48 UTC
Updated:
22 Oct 2008 at 06:44 UTC
Jump to comment: Most recent file
Comments
Comment #1
crizYes, I can confirm this...
Comment #2
sevi commentedI 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.
Comment #3
jpetso commentedAs 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
Comment #4
sevi commentedAs 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
Comment #5
jpetso commentedI 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".
Comment #6
jpetso commentedOk, 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.
Comment #7
jpetso commentedFixed, will push out a release (rc2) right now.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.