- imagefield_field in contributions/imagefield/imagefield.module
- Implementation of hook_field().
imagefield_file_update($node, &$file, $field)Update the file record if necessary.
$node Node object this file is be associated with.
$file A single CCK image field item to be updated.
$field The field definition for this image field.
contributions/imagefield/imagefield.module, line 279
<?php
function imagefield_file_update($node, &$file, $field) {
$file = (array)$file;
if ($file['flags']['delete'] == true) {
// don't delete files if we're creating new revisions, but still return an empty
// array...
if ($node->old_vid || _imagefield_file_delete($file, $field['field_name'])) {
return array();
}
}
if ($file['fid'] == 'upload') {
return imagefield_file_insert($node, $file, $field);
}
else {
// empty files without fid.
if ($file['fid'] == 0) {
$file = array();
}
// if fid is not numeric here we should complain.
// else we update the file table.
}
return $file;
}
?>