00001 <?php 00007 class views_handler_filter_node_tnid extends views_handler_filter { 00008 function admin_summary() { } 00009 function option_definition() { 00010 $options = parent::option_definition(); 00011 00012 $options['operator']['default'] = 1; 00013 00014 return $options; 00015 } 00016 00020 function operator_form(&$form, &$form_state) { 00021 $form['operator'] = array( 00022 '#type' => 'radios', 00023 '#title' => t('Include untranslated content'), 00024 '#default_value' => $this->operator, 00025 '#options' => array( 00026 1 => t('Yes'), 00027 0 => t('No'), 00028 ), 00029 ); 00030 } 00031 00032 function can_expose() { return FALSE; } 00033 00034 function query() { 00035 $table = $this->ensure_my_table(); 00036 // Select for source translations (tnid = nid). Conditionally, also accept either untranslated nodes (tnid = 0). 00037 $this->query->add_where_expression($this->options['group'], "$table.tnid = $table.nid" . ($this->operator ? " OR $table.tnid = 0" : '')); 00038 } 00039 }