file_load_multiple

  1. drupal
    1. drupal7
Versionen
drupal7 file_load_multiple($fids = array(), $conditions = array())

Load file objects from the database.

see hook_file_load()

Übergabeparameter

$fids An array of file IDs.

$conditions An array of conditions to match against the {files} table. These should be supplied in the form array('field_name' => 'field_value').

Rückgabewert

An array of file objects, indexed by fid.

See also

file_load()

Verwandte Themen

▾ 12 functions call file_load_multiple()

FileLoadTest::testLoadInvalidStatus in modules/simpletest/tests/file.test
Try to load a non-existent file by status.
FileLoadTest::testLoadMissingFilepath in modules/simpletest/tests/file.test
Try to load a non-existent file by filepath.
FileLoadTest::testMultiple in modules/simpletest/tests/file.test
This will test loading file data from the database.
FileSaveUploadTest::testNormal in modules/simpletest/tests/file.test
Test the file_save_upload() function.
file_copy in includes/file.inc
Copy a file to a new location and adds a file record to the database.
file_load in includes/file.inc
Load a file object from the database.
file_move in includes/file.inc
Move a file to a new location and update the file's database entry.
file_save_data in includes/file.inc
Save a string to the specified destination and create a database file entry.
file_save_upload in includes/file.inc
Saves a file upload to a new location.
upload_node_load in modules/upload/upload.module
Implementation of hook_node_load().
user_load_multiple in modules/user/user.module
Load multiple users based on certain conditions.
user_update_7004 in modules/user/user.install
Add the user's pictures to the {files} table and make them managed files.

Code

includes/file.inc, line 274

<?php
function file_load_multiple($fids = array(), $conditions = array()) {
  $query = db_select('files', 'f')->fields('f');

  // If the $fids array is populated, add those to the query.
  if ($fids) {
    $query->condition('f.fid', $fids, 'IN');
  }

  // If the conditions array is populated, add those to the query.
  if ($conditions) {
    foreach ($conditions as $field => $value) {
      $query->condition('f.' . $field, $value);
    }
  }
  $files = $query->execute()->fetchAllAssoc('fid');

  // Invoke hook_file_load() on the terms loaded from the database
  // and add them to the static cache.
  if (!empty($files)) {
    foreach (module_implements('file_load') as $module) {
      $function = $module . '_file_load';
      $function($files);
    }
  }
  return $files;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen