You are here

function references_dialog_node_reference_views_query in References dialog 7

View query callback for node references.

2 string references to 'references_dialog_node_reference_views_query'
hook_references_dialog_widgets in ./references_dialog.api.php
Define a widget to which you want to attach add, search or edit links.
references_dialog_references_dialog_widgets in ./references_dialog.dialog_widgets.inc
Implements hook_references_dialog_widgets().

File

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

Code

function references_dialog_node_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.
  $types = array();
  foreach ($field['settings']['referenceable_types'] as $type => $active) {
    if ($active !== 0) {
      $types[] = $type;
    }
  }
  $view->query
    ->add_where(0, "{$view->base_table}.type", $types);
}