You are here

function slickgrid_nodereference_autocomplete in Slickgrid 6

1 string reference to 'slickgrid_nodereference_autocomplete'
slickgrid_menu_alter in ./slickgrid.module
Implementation of hook_menu_alter().

File

./slickgrid.ahah.inc, line 213

Code

function slickgrid_nodereference_autocomplete($field_name, $string = '') {
  $fields = content_fields();
  $field = $fields[$field_name];
  $match = isset($field['widget']['autocomplete_match']) ? $field['widget']['autocomplete_match'] : 'contains';
  $matches = array();
  $references = _nodereference_potential_references($field, $string, $match, array(), 10);
  foreach ($references as $id => $row) {

    // Add a class wrapper for a few required CSS overrides.
    $matches[$row['title'] . " [nid:{$id}]"] = '<div class="reference-autocomplete">' . $row['rendered'] . '</div>';
  }
  slickgrid_json($matches);
}