augustin (beginner) wrote:
Hello,
In a module with its own node type, the node is not fully loaded when using preview.
In hook_load(), I return my own extra fields to the node: return array('mynodetype' => $extra);
In hook_view(), $node->mynodetype is set when viewing the node, but not when editing then previewing the same node. Isn't the node loaded as for a normal node view?
I've searched drupal.org but didn't find anything terribly useful.
I found this old forum post: Philosophy of 'Preview' http://drupal.org/node/126750
And this old core issue, which I had helped reviewing at the time, but which is supposed to be fixed (though it was not said how it was fixed): node previews broken by missing hook_submit http://drupal.org/node/104047
Is this a known issue?
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. --Larry Garfield