You are here

function commerce_file_field_presave in Commerce File 7

Implements hook_field_presave().

File

includes/commerce_file.field.inc, line 291
Implement an commerce_file field, based on the file module's file field.

Code

function commerce_file_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  file_field_presave($entity_type, $entity, $field, $instance, $langcode, $items);
  foreach ($items as $delta => $item) {

    // Serialize an existing data array.
    if (isset($item['data']) && is_array($item['data'])) {
      $items[$delta]['data'] = serialize($item['data']);
    }
  }
}