1 file.field.inc file_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items)

Implements hook_field_insert().

File

core/modules/file/file.field.inc, line 232
Field module functionality for the File module.

Code

function file_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
  // Add a new usage of each uploaded file.
  foreach ($items as $item) {
    if ($file = file_load($item['fid'])) {
      file_usage_add($file, 'file', $entity_type, $entity->id());
    }
  }
}