You are here

function smartqueue_taxonomy_nodequeue_autocomplete in Nodequeue 7.2

Same name and namespace in other branches
  1. 6.2 smartqueue.module \smartqueue_taxonomy_nodequeue_autocomplete()

Implements hook_nodequeue_autocomplete().

File

modules/smartqueue/smartqueue.module, line 456

Code

function smartqueue_taxonomy_nodequeue_autocomplete($queue, $subqueue, $string, &$query) {
  $matches = array();

  // Filtering by the reference
  $query
    ->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
  $query
    ->condition('ti.tid', $subqueue->reference, '=');
  $query
    ->addTag('i18n_select');
  $result = $query
    ->execute();
  foreach ($result as $node) {
    $id = nodequeue_get_content_id($queue, $node);
    $matches[$node->nid] = check_plain($node->title) . " [nid: {$id}]";
  }
  return $matches;
}