function filefield_source_reference_autocomplete in FileField Sources 6
Same name and namespace in other branches
- 7 sources/reference.inc \filefield_source_reference_autocomplete()
Menu callback; autocomplete.js callback to return a list of files.
1 string reference to 'filefield_source_reference_autocomplete'
- filefield_source_reference_menu in sources/
reference.inc - Implements hook_menu().
File
- sources/
reference.inc, line 165 - A FileField extension to allow referencing of existing files.
Code
function filefield_source_reference_autocomplete($type_name, $field_name, $filename) {
$field = content_fields($field_name, $type_name);
$items = array();
if (!empty($field)) {
$files = filefield_source_reference_get_files($filename, $field);
foreach ($files as $fid => $file) {
$items[$file->filename . " [fid:{$fid}]"] = theme('filefield_source_reference_autocomplete_item', $file);
}
}
drupal_json($items);
}