You are here

function references_dialog_term_reference_views_query in References dialog 7

View query callback for term references.

1 string reference to 'references_dialog_term_reference_views_query'
references_dialog_references_dialog_widgets in ./references_dialog.dialog_widgets.inc
Implements hook_references_dialog_widgets().

File

./references_dialog.dialog_widgets.inc, line 401
Implements dialogs for node reference and user reference fields.

Code

function references_dialog_term_reference_views_query($view, $instance, $field) {

  // We need to make sure that no entries that we can't add to our field shows
  // up, so we need to limit the data here.
  $vocabulary = taxonomy_vocabulary_machine_name_load($field['settings']['allowed_values'][0]['vocabulary']);
  $types = array(
    $vocabulary->vid,
  );
  $view->query
    ->add_where(0, "{$view->base_table}.vid", $types);
}