Skip to content
Snippets Groups Projects
Commit 56e4fb2b authored by Chris Leppanen's avatar Chris Leppanen
Browse files

git commit -m Issue

parent 189015f6
No related branches found
No related tags found
No related merge requests found
......@@ -124,6 +124,31 @@ function hook_feeds_before_import(FeedsSource $source) {
// See feeds_rules module's implementation for an example.
}
/**
* Invoked after a feed item has been saved.
*
* @param $source
* FeedsSource object that describes the source that is being imported.
* @param $entity
* The entity object that has just been saved.
* @param $item
* The parser result for this entity.
*/
function hook_feeds_after_save(FeedsSource $source, $entity, $item) {
// Use $entity->nid of the saved node.
// Although the $entity object is passed by reference, any changes made in
// this function will be ignored by the FeedsProcessor.
$config = $source->importer()->getConfig();
if ($config['processor']['config']['purge_unseen_items'] && isset($entity->feeds_item)) {
$feeds_item = $entity->feeds_item;
$feeds_item->batch_id = feeds_delete_get_current_batch($feeds_item->feed_nid);
drupal_write_record('feeds_delete_item', $feeds_item);
}
}
/**
* Invoked after a feed source has been imported.
*
......
......@@ -235,6 +235,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
$this->entitySaveAccess($entity);
$this->entitySave($entity);
// Allow modules to perform operations using the saved entity data.
// $entity contains the updated entity after saving.
module_invoke_all('feeds_after_save', $source, $entity, $item);
// Track progress.
if (empty($entity_id)) {
$state->created++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment