You are here

function civicrm_entity_autocomplete in CiviCRM Entity 7.2

Menu callback for autocomplete search function

Parameters

$entity_type:

1 string reference to 'civicrm_entity_autocomplete'
civicrm_entity_menu in ./civicrm_entity.module
Implements hook_menu().

File

./civicrm_entity.module, line 81

Code

function civicrm_entity_autocomplete($entity_type, $string = '') {
  $matches = array();
  if ($string) {
    switch ($entity_type) {
      case 'Contact':
        $matches = _civicrm_entity_db_select($entity_type, $string, 'display_name');
        break;
      case 'Event':
        $matches = _civicrm_entity_db_select($entity_type, $string, 'title');
        break;
    }
  }
  drupal_json_output($matches);
}