You are here

function _jqp_autocomplete in jQuery Plugin Handler (JQP) 6.2

AJAX response function for #autocomplete form elements.

Returns all .css and .js file paths matching the search string.

1 string reference to '_jqp_autocomplete'
jqp_menu in ./jqp.module
Implementation of hook_menu().

File

./jqp.admin.inc, line 403
This file includes all functionality for the libraries configuration pages

Code

function _jqp_autocomplete() {
  $matches = array();
  $args = func_get_args();
  if (!empty($args)) {
    $string = join('/', $args);
    foreach (jqp_scan_dir() as $file) {
      if (strstr($file->filename, $string)) {
        $matches[$file->filename] = $file->filename;

        // stop if the matches exceed 10 elements
        if (count($matches) >= 20) {
          break;
        }
      }
    }
  }
  drupal_json($matches);
}