FeedImportMergeOverwrite.php in Feed Import 8
File
feed_import_base/src/FeedImportMergeOverwrite.php
View source
<?php
namespace Drupal\feed_import_base;
class FeedImportMergeOverwrite extends FeedImportMergeField {
public function overwriteEmpty() {
return TRUE;
}
public function merge(array &$current, array &$new, array &$field) {
$cnt = count($new);
if ($cnt != count($current)) {
$current = $new;
return TRUE;
}
$changed = FALSE;
for ($i = 0; $i < $cnt; $i++) {
if (!$field['compare']($new[$i], $current[$i])) {
$current[$i] = $new[$i];
$changed = TRUE;
}
}
return $changed;
}
}
Classes
Name |
Description |
FeedImportMergeOverwrite |
Class which overwrites values. A simple value by value comparison is made.
This also overwrites values if missing from source. |