On Saturday 28 March 2009 03:47:54 larry@garfieldtech.com wrote:
Sort of. Remember that despite being called $node what you get for preview and insert/update hooks is NOT a node object. It's $form_state['values']. Unless you call node_save() yourself from soemwhere, in which case it IS a node object. Thus you need to structure your node data and your node form additions to parallel each other, or stuff breaks horribly in horrific ways.
This is a known design flaw in the node system. It royally sucks on innumerable levels. I think the most likely solution in the long run is "if it's not a Field, sucks to be you, use Fields".
Not a great solution, but it is what it is.
Hmmm, yes. Great comments. Now that you mention it, I had observed this before but it didn't really 'click' until now. Thanks. That's crazy, really. The same function hook_view() would be passed either a fully loaded node in case of a normal node view OR a half backed, FAPI-ish node in case of a node preview (either when creating a new node or editing an existing one).
Thus you need to structure your node data and your node form additions to parallel each other, or stuff breaks horribly in horrific ways.
I think I am starting to get this... ! ;) Is this design flaw still applicable in Drupal 7? Is there an issue about it? In conclusion, if I understand well the replies I got, the problems I have been experiencing are to be expected and I should take care myself to handle special cases accordingly. Thanks again to all three for your replies. Blessings, Augustin. -- http://openteacher.info/ http://overshoot.tv/ http://charityware.info/ http://minguo.info/