class FeedImportMergeDuplicates in Feed Import 8
Class which merges field values without checking for duplicates.
Hierarchy
- class \Drupal\feed_import_base\FeedImportMergeField
- class \Drupal\feed_import_base\FeedImportMergeDuplicates
Expanded class hierarchy of FeedImportMergeDuplicates
File
- feed_import_base/
src/ FeedImportMergeDuplicates.php, line 7
Namespace
Drupal\feed_import_baseView source
class FeedImportMergeDuplicates extends FeedImportMergeField {
/**
* {@inheritdoc}
*/
public function merge(array &$current, array &$new, array &$field) {
if ($field['cardinality'] == -1) {
$current = array_merge($current, $new);
return TRUE;
}
elseif (($cnt = count($current)) < $field['cardinality']) {
$cnt = $field['cardinality'] - $cnt;
$current = array_merge($current, count($new) <= $cnt ? $new : array_slice($new, 0, $cnt));
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedImportMergeDuplicates:: |
public | function |
Merge the new and current field values.
The merge should be set in $current ref. variable Overrides FeedImportMergeField:: |
|
FeedImportMergeField:: |
public | function | Remove field if is missing from source. | 1 |