You are here

function webform_references_autocomplete_view in Webform References 7

1 string reference to 'webform_references_autocomplete_view'
webform_references_menu in ./webform_references.module
Implements hook_menu().

File

./webform_references.module, line 166
Webform module node reference component.

Code

function webform_references_autocomplete_view($type, $view_name, $display_name, $args = NULL, $string = '') {

  // need to gather the arguments to figure out what needs to be sent to the view
  $args = func_get_args();

  // Shift off the $type, $view_name, $display_name
  $args = array_slice($args, 3);

  // Get the string and pass the remainder as view arguments
  $string = array_pop($args);
  $result = webform_references_execute_view($view_name, $display_name, $type, $args, $string);
  $matches = array();
  foreach ($result as $id => $value) {
    $name = trim(strip_tags($value));
    $matches[$name . " [id:{$id}]"] = $name;
  }
  drupal_json_output($matches);
}