You are here

function field_reference_field_presave in Field reference 7

Implements hook_field_presave().

File

./field_reference.module, line 551
Defines a field type for referencing a field from another.

Code

function field_reference_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  foreach (array_keys($items) as $delta) {

    // For widgets not defined by this module that invoke this function, check
    // there is only a single key set before converting the value.
    if (count($items[$delta]) === 1) {
      $items[$delta] = field_reference_key_read($items[$delta]['field_key']);
    }
  }
}