You are here

function _filefield_file_load in FileField 5.2

Same name and namespace in other branches
  1. 5 filefield.module \_filefield_file_load()
2 calls to _filefield_file_load()
filefield_field in ./filefield.module
Implementation of hook_field().
filefield_field_formatter in ./filefield.module

File

./filefield.module, line 736
Defines a file field type.

Code

function _filefield_file_load($fid = NULL) {

  // Don't bother if we weren't passed and fid.
  if (!empty($fid) && is_numeric($fid)) {
    $result = db_query('SELECT * FROM {files} WHERE fid = %d', $fid);
    $file = db_fetch_array($result);
    if ($file) {

      // let modules load extended attributes.
      $file += module_invoke_all('filefield', 'file_load', $node, $field, $file);
      return $file;
    }
  }

  // return an empty array if nothing was found.
  return array();
}