You are here

function demo_autocomplete in Demonstration site (Sandbox / Snapshot) 5

Same name and namespace in other branches
  1. 6 demo.admin.inc \demo_autocomplete()

Retrieve a pipe delimited string of autocomplete suggestions for existing snapshot names.

1 string reference to 'demo_autocomplete'
demo_menu in ./demo.module
Implementation of hook_menu().

File

./demo.admin.inc, line 526
Demonstration Site administrative pages

Code

function demo_autocomplete($string = '') {
  $matches = array();
  if ($string && ($fileconfig = demo_get_fileconfig())) {
    $string = preg_quote($string);
    $files = file_scan_directory($fileconfig['dumppath'], $string . '.*\\.info$');
    foreach ($files as $file) {
      $matches[$file->name] = check_plain($file->name);
    }
  }
  print drupal_to_js($matches);
  exit;
}