You are here

function filefield_file_update in FileField 5

Same name and namespace in other branches
  1. 5.2 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 117
Defines a file field type.

Code

function filefield_file_update($node, &$file, $field) {
  $file = (array) $file;
  if ($file['remove'] == TRUE) {
    _filefield_file_delete($file, $field['field_name']);

    // should I return an array here instead as imagefield does, or is that a bug in
    // in imagefield. I remember I was working on a content.module patch that would
    // delete multivalue fields whose value was NULL. Maybe a leftover.
    return NULL;
  }
  if ($file['fid'] == 'upload') {
    return filefield_file_insert($node, $file, $field);
  }
  else {

    // if fid is not numeric here we should complain.
    // else we update the file table.
  }
  return $file;
}