Dear all,
my first post to this great community!
I wrote a custom module dealing with a node, with its nice hook_submit() implementation. This function is called both when the node is created and when a node is updated.
I need to insert a term in a vocabulary and associate it with the node when the node is created; and I need to do nothing when the node is updated.
Which is the way in hook_submit() to understand whether the node is being created or updated?
Thanks and apologies in advance as most likely it is an issue I could have tackled myself,
Davide
I found it myself ...
/** * Implementation of hook_submit(). */ function sperimentazione_submit(&$node) {
if (!IsSet($node->nid)) { // if $node->nid is not set then the node is new .... }
Davide Galletti ha scritto:
Dear all,
my first post to this great community!
I wrote a custom module dealing with a node, with its nice hook_submit() implementation. This function is called both when the node is created and when a node is updated.
I need to insert a term in a vocabulary and associate it with the node when the node is created; and I need to do nothing when the node is updated.
Which is the way in hook_submit() to understand whether the node is being created or updated?
Thanks and apologies in advance as most likely it is an issue I could have tackled myself,
Davide