You are here

function uuidreference_field_presave in UUID reference field 7

Implements hook_field_presave().

Adds the target type to the field data structure when saving.

File

./uuidreference.module, line 415

Code

function uuidreference_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  foreach ($items as $delta => $item) {
    if (uuidreference_field_is_empty($item, $field)) {
      unset($items[$delta]);
    }
    else {
      $items[$delta]['target_type'] = $field['settings']['target_type'];
    }
  }
}