annotate vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_load.twig @ 5:12f9dff5fda9
tip
Update to Drupal core 8.7.1
author |
Chris Cannam |
date |
Thu, 09 May 2019 15:34:47 +0100 |
parents |
c75dbcec494b |
children |
|
rev |
line source |
Chris@0
|
1 /**
|
Chris@0
|
2 * Implements hook_file_load().
|
Chris@0
|
3 */
|
Chris@0
|
4 function {{ machine_name }}_file_load($files) {
|
Chris@0
|
5 // Add the upload specific data into the file object.
|
Chris@0
|
6 $result = db_query('SELECT * FROM {upload} u WHERE u.fid IN (:fids)', array(':fids' => array_keys($files)))->fetchAll(PDO::FETCH_ASSOC);
|
Chris@0
|
7 foreach ($result as $record) {
|
Chris@0
|
8 foreach ($record as $key => $value) {
|
Chris@0
|
9 $files[$record['fid']]->$key = $value;
|
Chris@0
|
10 }
|
Chris@0
|
11 }
|
Chris@0
|
12 }
|