diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e50d743b505815de7b61d75a2ca15da84f2fa548..869e018192647bf6050596345246330fe80e4570 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,8 @@ Feeds 6.x 1.0 xxxxx xx, xxxx-xx-xx ---------------------------------- +- alex_b: Add sourceSave() and sourceDelete() methods notifying plugin + implementers of a source being saved or deleted. - #717168 nicholasThompson: Fix feeds UI JS doesn't select labels correctly. - #708228 Scott Reynolds, alex_b: Break FeedsImportBatch into separate classes. NOTE: FeedsFetcher implementations cannot use FeedsImportBatch directly diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index 320a3643ff22a1a07990956e23cd57de03186a2f..ca10c67e51c29b1f71bc71232500918811749952 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -38,7 +38,17 @@ interface FeedsSourceInterface { /** * Validate user entered values submitted by sourceForm(). */ - public function sourceFormValidate(&$values); + public function sourceFormValidate(&$source_config); + + /** + * A source is being deleted. + */ + public function sourceSave(FeedsSource $source); + + /** + * A source is being saved. + */ + public function sourceDelete(FeedsSource $source); } /** @@ -164,6 +174,10 @@ class FeedsSource extends FeedsConfigurable { */ public function save() { $config = $this->getConfig(); + // Alert implementers of FeedsSourceInterface to the fact that we're saving. + foreach ($this->importer->plugin_types as $type) { + $this->importer->$type->sourceSave($this); + } // Store the source property of the fetcher in a separate column so that we // can do fast lookups on it. $source = ''; @@ -206,6 +220,11 @@ class FeedsSource extends FeedsConfigurable { * from database, does not delete configuration itself. */ public function delete() { + // Alert implementers of FeedsSourceInterface to the fact that we're + // deleting. + foreach ($this->importer->plugin_types as $type) { + $this->importer->$type->sourceDelete($this); + } db_query('DELETE FROM {feeds_source} WHERE id = "%s" AND feed_nid = %d', $this->id, $this->feed_nid); } diff --git a/plugins/FeedsPlugin.inc b/plugins/FeedsPlugin.inc index 1d4f3f396a77be765caeeb60b4303e90afc0e0cd..083dcdf3c0c40dcce12237eb90cbd1376f0e696b 100644 --- a/plugins/FeedsPlugin.inc +++ b/plugins/FeedsPlugin.inc @@ -67,7 +67,17 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter /** * Validation handler for sourceForm. */ - public function sourceFormValidate(&$values) {} + public function sourceFormValidate(&$source_config) {} + + /** + * A source is being saved. + */ + public function sourceSave(FeedsSource $source) {} + + /** + * A source is being deleted. + */ + public function sourceDelete(FeedsSource $source) {} } /**