You are here

function image_field_caption_file_load in Image Field Caption 7

Implements hook_file_load().

File

./image_field_caption.module, line 236
Provides a caption textarea for image fields.

Code

function image_field_caption_file_load($files) {

  // Add caption data into the file object.
  $result = db_query('SELECT fid, caption FROM {image_field_caption} WHERE fid IN (:fids)', array(
    ':fids' => array_keys($files),
  ))
    ->fetchAll(PDO::FETCH_ASSOC);
  foreach ($result as $record) {
    foreach ($record as $key => $value) {
      $files[$record['fid']]->{$key} = $value;
    }
  }
}