function filefield_file_update in FileField 5.2
Same name and namespace in other branches
- 5 filefield.module \filefield_file_update()
update the file record if necessary
Parameters
$node:
$file:
$field:
1 call to filefield_file_update()
- filefield_field in ./
filefield.module - Implementation of hook_field().
File
- ./
filefield.module, line 196 - Defines a file field type.
Code
function filefield_file_update($node, $field, &$file) {
$file = (array) $file;
if ($file['delete'] == TRUE) {
// don't delete files if we're creating new revisions,
// but still return an empty array...
if ($node->old_vid) {
return array();
}
if (_filefield_file_delete($node, $field, $file)) {
return array();
}
}
if ($file['fid'] == 'upload') {
return filefield_file_insert($node, $field, $file);
}
else {
// if fid is not numeric here we should complain.
// else we update the file table.
}
return $file;
}