Skip to content
Snippets Groups Projects
Commit f13213cc authored by Alex Barth's avatar Alex Barth
Browse files

Add sourceSave() and sourceDelete() methods notifying plugin implementers of a...

Add sourceSave() and sourceDelete() methods notifying plugin implementers of a source being saved or deleted. Minor cleanup on sourceForm().
parent baa75271
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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);
}
......
......@@ -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) {}
}
/**
......
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