function hook_feeds_before_update in Feeds 8.2
Same name and namespace in other branches
- 7.2 feeds.api.php \hook_feeds_before_update()
Invoked before a feed item is updated/created/replaced.
This is called every time a feed item is processed no matter if the item gets updated or not.
Parameters
FeedsSource $source: The source for the current feed.
array $item: All the current item from the feed.
int|null $entity_id: The id of the current item which is going to be updated. If this is a new item, then NULL is passed.
Related topics
1 invocation of hook_feeds_before_update()
- FeedsProcessor::process in lib/
Drupal/ feeds/ Plugin/ FeedsProcessor.php - Process the result of the parsing stage.
File
- ./
feeds.api.php, line 124 - Documentation of Feeds hooks.
Code
function hook_feeds_before_update(FeedsSource $source, $item, $entity_id) {
if ($entity_id) {
$processor = $source->importer->processor;
db_update('foo_bar')
->fields(array(
'entity_type' => $processor
->entityType(),
'entity_id' => $entity_id,
'last_seen' => REQUEST_TIME,
))
->condition('entity_type', $processor
->entityType())
->condition('entity_id', $entity_id)
->execute();
}
}