5

I am wondering how to implement a Hook after the import of one of my importers is finished. The last imported node and the name of the importer itself would be the parameters that i need to have at this time.

Background/Usecase:

The site I'm working on is built to control IT-projects. After the user imports the bill-positions (each one a row in a CSV file => node in Drupal), which happens monthly, the site has to check if all bill-positions for a customer have been invoiced.

This is only one example, there are many other examinations that need to be done after an import is done.

I read the Feeds API & documentation, but I didn't find anything useful.

P.S. I'm pretty new to open source and Drupal itself; so please correct me if I am missing any guideline.

1

I have never used this, but you can try hook_feeds_after_import. You will likely need to kpr the $source parameter to the hook.

You may also be able to something with Rules. Feeds events don't appear in Rules (unless there is a module I don't know about), but you may be able to trigger on the node save and update events filtered to the content type(s) that you are importing to.

  • The hook you mentioned executes after a single line is imported, not the hole file. Got to check the Rules module, but to trigger on a single node_save or node_update is not what i am looking for. As i said, i need to find a way to hook me in, after the import of a hole file is done. – Highclass May 30 '12 at 8:47
  • 1
    I don't know how you make use of a hook after the whole file import though... It's a batch operation so you can use your own custom callback function upon successful submission. Not sure if you can alter it using a module though – AyeshK Jul 28 '12 at 17:50
  • The hook_feeds_after_import is called after the whole file is processed. It can be used for such things. – mouhammed Sep 11 '15 at 8:24

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.