You are here

function _linkit_autocomplete in Linkit 7.2

Autocomplete callback function.

1 string reference to '_linkit_autocomplete'
linkit_menu in ./linkit.module
Implements hook_menu().

File

./linkit.module, line 259
Main file for linkit module.

Code

function _linkit_autocomplete($search = NULL) {
  $search = $_GET['s'];
  $enabled_plugins = linkit_get_profile_plugins();

  // Absolute URL
  if ($result = _linkit_result_from_url($search, $enabled_plugins)) {
    $results = array(
      $result,
    );
  }
  elseif (!($results = _linkit_autocomplete_search($search, $enabled_plugins))) {
    $results = array(
      array(
        'title' => t('No results'),
        'addClass' => 'status-notice',
        'disabled' => TRUE,
      ),
    );
  }
  drupal_json_output($results);
  drupal_exit();
}