I have a complex use case with workbench_moderation and revisions that made me want to do "fancy stuff" on nodes before they get updated by Feeds. Things like disabling generation of a new revision, etc...

After a long investigation, I found a KISS method that relies on hook_node_prepare(). However, that means I need a little information to determine in my custom module (and potentially contribs) that the node is being prepared by Feeds, so I made this simple patch that puts the FeedsSource object inside the node before running it into prepare. As an example, I could implement:

<?php
mymodule_node_prepare($node) {
  if (isset($node->feeds_source) && $node->feeds_source->id == 'source_foo') {
    // Do not generate new revision for this update.
    $node->revision = FALSE;
  }
}
?>
CommentFileSizeAuthor
feeds_hook_node_prepare.patch709 bytesfranz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dealancer’s picture

Nice solution.

Instead we can provide invoke of additional hook in feeds module before node preparation call. That will allow to better document this new feature.

franz’s picture

In that case, I'd add 2 hooks:

1 - When node is loaded/built and before filling the values
2 - After filling the values and before node_prepare

twistor’s picture

Issue summary: View changes
Status: Needs review » Needs work

I'm not sure what other "fancy stuff" you are doing, but we should have an option to disable revision generation.

I realize this issue is really old, just trawling through the issues.