You are here

function hook_file_update_index in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.api.php \hook_file_update_index()

Act on a file being indexed for searching.

This hook is invoked during search indexing, after file_load(), and after the result of file_view() is added as $file->rendered to the file object.

Parameters

object $file: The file being indexed.

Return value

string Additional file information to be indexed.

File

./file_entity.api.php, line 255
Hooks provided by the File Entity module.

Code

function hook_file_update_index($file) {
  $text = '';
  $uses = db_query('SELECT module, count FROM {file_usage} WHERE fid = :fid', array(
    ':fid' => $file->fid,
  ));
  foreach ($uses as $use) {
    $text .= '<h2>' . check_plain($use->module) . '</h2>' . check_plain($use->count);
  }
  return $text;
}