You are here

function _bibcite_entity_process_field_value in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/bibcite_entity.batch.inc \_bibcite_entity_process_field_value()

Find source field value and replace or remove it.

Parameters

array $field_value: Field value array.

int $source_id: Source entity identifier.

int $target_id: Target entity identifier.

1 call to _bibcite_entity_process_field_value()
bibcite_entity_merge_entity in modules/bibcite_entity/bibcite_entity.batch.inc
Batch operation. Change change source contributor id to target.

File

modules/bibcite_entity/bibcite_entity.batch.inc, line 95
Batch callbacks.

Code

function _bibcite_entity_process_field_value(array &$field_value, $source_id, $target_id) {
  $target_delta = _bibcite_entity_get_target_delta($field_value, $target_id);
  foreach ($field_value as $delta => $value) {
    if ($value['target_id'] == $source_id) {
      if (isset($target_delta)) {
        unset($field_value[$delta]);
      }
      else {
        $field_value[$delta]['target_id'] = $target_id;
      }
    }
  }
}