function imagefield_file_update in ImageField 5
Same name and namespace in other branches
- 5.2 imagefield.module \imagefield_file_update()
 
update the file record if necessary
Parameters
$node:
$file:
$field:
1 call to imagefield_file_update()
- imagefield_field in ./
imagefield.module  - Implementation of hook_field().
 
File
- ./
imagefield.module, line 124  - Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.
 
Code
function imagefield_file_update($node, &$file, $field) {
  $file = (array) $file;
  if ($file['flags']['delete'] == TRUE) {
    if (_imagefield_file_delete($file, $field['field_name'])) {
      return array();
    }
  }
  if ($file['fid'] == 'upload') {
    return imagefield_file_insert($node, $file, $field);
  }
  else {
    // if fid is not numeric here we should complain.
    // else we update the file table.
  }
  return $file;
}