Index: search_attachments.module =================================================================== --- search_attachments.module (revision 138) +++ search_attachments.module (working copy) @@ -1432,10 +1432,30 @@ } } - return $file_text; + return search_attachments_get_file_name($file_path) . $file_text; } /** + * Get "name" metadata from driver based on file path. + */ +function search_attachments_get_file_name($file_path) { + // Query module type from {search_attachments_files} + $result = db_query("SELECT module, module_id FROM {search_attachments_files} WHERE file_path = '%s'", $file_path); + $row = db_fetch_array($result); + $module = $row['module']; + $module_id = $row['module_id']; + // Call correct function for this module type + $drivers = search_attachments_get_drivers(); + $driver_file = $drivers[$module]; + include_once($driver_file['path']); + $driver_get_file = 'search_attachments_get_'. $module .'_file'; + if (function_exists($driver_get_file)) { + $file_info = $driver_get_file($module_id); + return $file_info['name']; + } +} + +/** * Get list of all file manager drivers (each is a file in the pattern xxx_driver.inc in the * search_attachments, directory, where xxx is the name of a file management module) for which the * applicable module is enabled. $drivers is an associative array with the keys 'name' and 'path'.