Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/modules/translation/views_handler_filter_node_tnid.inc
11 11
 * @ingroup views_filter_handlers
12 12
 */
13 13
class views_handler_filter_node_tnid extends views_handler_filter {
14
  function admin_summary() { }
15
  function option_definition() {
14

  
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function admin_summary() {
19
  }
20

  
21
  /**
22
   * {@inheritdoc}
23
   */
24
  public function option_definition() {
16 25
    $options = parent::option_definition();
17 26

  
18 27
    $options['operator']['default'] = 1;
......
21 30
  }
22 31

  
23 32
  /**
24
   * Provide simple boolean operator
33
   * Provide simple boolean operator.
25 34
   */
26
  function operator_form(&$form, &$form_state) {
35
  public function operator_form(&$form, &$form_state) {
27 36
    $form['operator'] = array(
28 37
      '#type' => 'radios',
29 38
      '#title' => t('Include untranslated content'),
......
35 44
    );
36 45
  }
37 46

  
38
  function can_expose() { return FALSE; }
47
  /**
48
   * {@inheritdoc}
49
   */
50
  public function can_expose() {
51
    return FALSE;
52
  }
39 53

  
40
  function query() {
54
  /**
55
   * {@inheritdoc}
56
   */
57
  public function query() {
41 58
    $table = $this->ensure_my_table();
42
    // Select for source translations (tnid = nid). Conditionally, also accept either untranslated nodes (tnid = 0).
43
    $this->query->add_where_expression($this->options['group'], "$table.tnid = $table.nid" . ($this->operator ? " OR $table.tnid = 0" : ''));
59
    // Select for source translations (tnid = nid). Conditionally, also accept
60
    // either untranslated nodes (tnid = 0).
61
    $expression = "$table.tnid = $table.nid";
62
    if ($this->operator) {
63
      $expression .= " OR $table.tnid = 0";
64
    }
65
    $this->query->add_where_expression($this->options['group'], $expression);
44 66
  }
67

  
45 68
}

Formats disponibles : Unified diff