You are here

FeedImportMergeField.php in Feed Import 8

File

feed_import_base/src/FeedImportMergeField.php
View source
<?php

namespace Drupal\feed_import_base;


/**
 * Abstract class that helps merging fields on update.
 */
abstract class FeedImportMergeField {

  /**
   * Remove field if is missing from source.
   *
   * @return bool
   *    True to overwrite
   */
  public function overwriteEmpty() {
    return FALSE;
  }

  /**
   * Merge the new and current field values.
   * The merge should be set in $current ref. variable
   *
   * @param array $current
   *    Current field values
   * @param array $new
   *    New field values
   * @param array $field
   *    Field info
   *      cardinality - field cardinality
   *      compare - compare function for field value
   *
   * @return bool
   *    True if $current was changed
   */
  public abstract function merge(array &$current, array &$new, array &$field);

}

Classes

Namesort descending Description
FeedImportMergeField Abstract class that helps merging fields on update.