function file_field_insert

Implements hook_field_insert().

1 call to file_field_insert()
image_field_insert in modules/image/image.field.inc
Implements hook_field_insert().

File

modules/file/file.field.inc, line 239

Code

function file_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
    list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
    // Add a new usage of each uploaded file.
    foreach ($items as $item) {
        $file = (object) $item;
        file_usage_add($file, 'file', $entity_type, $id);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.