[development] node not fully loaded in hook_view() when previewing

Jakob Petsovits jpetso at gmx.at
Fri Mar 27 07:46:54 UTC 2009


On Friday 27 March 2009, 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?

No, because it might not even exist yet in the database ("create content").
However, submitted values as in $form_state['values'] will be merged into the 
node object on preview and save, so you might e.g. add more node properties in 
hook_nodeapi($op='validate'), or stuff.

Cheers,
  j



More information about the development mailing list