This hook is called when ever is a feed item is going to be updated. This hook is called no matter if the feed item is updated or not.

In the feeds delete module this is used to track when the item in the feed was last seen.

Example of implementation see http://drupal.org/sandbox/gordon/1939256

Comments

Status: Needs review » Needs work

The last submitted patch, 0001-Add-new-hook-hook_feeds_before_update.patch, failed testing.

gordon’s picture

Status: Needs work » Needs review
StatusFileSize
new2.12 KB

I have fixed up the example which was failing the php lint check.

johnv’s picture

gordon’s picture

No this hook is invoked before the update of the entity, and is invoked every time a feed item is imported no matter if the entity is going to be updated or not.

With the feeds delete module it enabled me to track items in a feed to seem when they have been removed from the feeds it self.

twistor’s picture

Component: Documentation » Code
Status: Needs review » Needs work
+++ b/feeds.api.phpundefined
@@ -307,5 +307,29 @@ function my_module_form_callback($mapping, $target, $form, $form_state) {
+ *  The current FeedsProcessor object

missing period.

+++ b/feeds.api.phpundefined
@@ -307,5 +307,29 @@ function my_module_form_callback($mapping, $target, $form, $form_state) {
+ * @param $entity_id

int|null

+++ b/feeds.api.phpundefined
@@ -307,5 +307,29 @@ function my_module_form_callback($mapping, $target, $form, $form_state) {
+ *  The id of the current item which is going to be updated. If this is a new item then NULL is past.

If this is a new item, then it will be NULL.

+++ b/plugins/FeedsProcessor.incundefined
@@ -183,6 +183,8 @@ abstract class FeedsProcessor extends FeedsPlugin {
+      module_invoke_all('feeds_before_update', $source, $this, $parser_result, $entity_id);

We should remove the processor from the arguments. It can be obtained from the source.

Why are you passing in the full $parser_result?

gordon’s picture

Status: Needs work » Needs review
StatusFileSize
new2.04 KB

I have made these changes, and change the parameters to be similar to the hook_feeds_after_save(). But the problem with removing the $processor it means you need the patch in #1962008: Add getter to Feedsimporter to allow Retreiving of plugin objects to get access to the processor.

But as long as this goes in you can use the example.

twistor’s picture

(edit) Moved to appropriate issue.

twistor’s picture

Version: 7.x-2.x-dev » 6.x-1.x-dev
Assigned: gordon » Unassigned
Status: Needs review » Patch (to be ported)

Ok, I've committed this. I went ahead and added the $entity_id back to all of the appropriate hooks since that is the only consistent way to do it.

Also fixed up the docs and added the hooks to hook_hook_info().

twistor’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)
megachriz’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Status: Closed (outdated) » Closed (fixed)