public function FeedTypeTamperMeta::rectifyInstances in Feeds Tamper 8.2
Removes tamper instances whose source was removed from the mapping.
Overrides FeedTypeTamperMetaInterface::rectifyInstances
File
- src/
FeedTypeTamperMeta.php, line 151
Class
- FeedTypeTamperMeta
- Class for managing tamper plugins for a feed type.
Namespace
Drupal\feeds_tamperCode
public function rectifyInstances() {
// Check the difference between the tampers grouped by source and a list of
// all sources used in mapping. By diffing we keep an array of tampers
// belonging to a source that is no longer used in the mapping.
$tampers_by_source_to_remove = array_diff_key($this
->getTampersGroupedBySource(), $this
->getUniqueSourceList());
// Remove these tamper instances.
foreach ($tampers_by_source_to_remove as $tampers) {
foreach ($tampers as $uuid => $tamper) {
$this
->removeTamper($uuid);
}
}
}