If I implement hook_node_submit(), will it be invoked when I import nodes from a feed?


I believe hook_node_submit() only gets fired when submitting a node form. So the answer to your question is no.

I think you might be better off using hook_node_presave(). This hook is invoked from node_save() before the node is saved to the database.

  • I need something that clears the cache when a content person goes in and changes something. Doing this when EVERY node saves would cause a site crash due to the amount of data pulled in through a feed. – Heather Jun 3 '15 at 15:29
  • @Heather Is there a way you can run cache_clear_all() after data is pulled through the feed? – albertski Jun 3 '15 at 15:38
  • I don't want it to. It runs on cron anyway. I just need clear_cache_all() to run when a user goes in and edits or adds content, not when all nodes are created. Does that make sense? – Heather Jun 3 '15 at 16:47
  • @Heather perhaps hook_node_update() and hook_node_insert() will help you. Check this answer out: drupal.stackexchange.com/questions/48600/… – albertski Jun 4 '15 at 15:45

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.