As said from @Clive, the only way is to compare the value in $node
with the value contained in $node->original
.
As far as I can see, that value is only available in hook_node_edit()
hook_node_update()
, hook_node_update()
,hook_node_presave()
and every hook invoked from hook_node_presave()
node_save()
which receive the saved node as argument (but only when a node is updated), since entity_load_unchanged()
is called from node_save()
(which also unset $node->original
before exiting). If you need it in hook_node_submit()
hook_node_submit()
you could simply add the following code in your implementation.
if (!empty($node->nid) && !isset($node->original)) {
$node->original = entity_load_unchanged('node', $node->nid);
}
if (!empty($node->nid) && !isset($node->original)) {
$node->original = entity_load_unchanged('node', $node->nid);
}
Since you are checking for field properties, the other, more general, hook would be hook_field_attach_submit(hook_field_attach_submit($entity_type, $entity, $form, &$form_state))
. With this hook, $entity
would contain the field value before the node has been edited, and $form_state
contains the submitted values.