You are here

function views_handler_filter_node_tnid::query in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 modules/translation/views_handler_filter_node_tnid.inc \views_handler_filter_node_tnid::query()
  2. 7.3 modules/translation/views_handler_filter_node_tnid.inc \views_handler_filter_node_tnid::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter::query

File

modules/translation/views_handler_filter_node_tnid.inc, line 32

Class

views_handler_filter_node_tnid
Filter by whether the node is the original translation.

Code

function query() {
  $table = $this
    ->ensure_my_table();

  // Select for source translations (tnid = nid). Conditionally, also accept either untranslated nodes (tnid = 0).
  $this->query
    ->add_where($this->options['group'], "{$table}.tnid = {$table}.nid" . ($this->operator ? " OR {$table}.tnid = 0" : ''));
}