0

In a custom module I use hook_node_presave($node) on node objects with referenced fields.

When creating a new node, ddebug_backtrace() shows that entity_save is called first and then node_save. Which leads to two new nodes. At the end of hook_node_presave() I have one correctly created node and one with only partially filled fields.

How can I prevent node_save to fire in hook_node_presave() when entity_save was already executed? Or maybe the solution is to prevent entity_save to fire?

Could anybody please explain how to correctly use hook_node_presave() on node objects with attached referenced fields?

1

Just in case anybody else experiences the same strange problem. In my case the reason was module CER (Corresponding Entity References) 7.x-3.0-alpha7. For any reason after a complete uninstall and clean reinstall hook_node_presave() now works fine with entity referenced fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.