You are here

function linkit_file_linkit_load_plugins in Linkit 6

Same name and namespace in other branches
  1. 7 plugins/linkit_file/linkit_file.module \linkit_file_linkit_load_plugins()

Implementation of hook_linkit_load_plugins().

File

plugins/linkit_file/linkit_file.module, line 11
Extend Linkit with files.

Code

function linkit_file_linkit_load_plugins($string) {
  $matches = array();

  // Get files.
  $result = db_query("SELECT f.fid, f.filename, f.filepath FROM {files} f WHERE f.filename LIKE LOWER('%%%s%%%') AND f.status = 1", $string);
  while ($file = db_fetch_object($result)) {
    $matches['file'][] = array(
      'title' => $file->filename,
      'path' => base_path() . $file->filepath,
      'information' => array(
        'type' => 'File',
      ),
    );
  }
  return $matches;
}