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/handlers/views_handler_filter_many_to_one.inc
6 6
 */
7 7

  
8 8
/**
9
 * Complex filter to handle filtering for many to one relationships,
10
 * such as terms (many terms per node) or roles (many roles per user).
9
 * Complex filter to handle filtering for many to one relationships.
10
 *
11
 * Examples: terms (many terms per node), roles (many roles per user).
11 12
 *
12 13
 * The construct method needs to be overridden to provide a list of options;
13 14
 * alternately, the value_form and admin_summary methods need to be overriden
......
16 17
 * @ingroup views_filter_handlers
17 18
 */
18 19
class views_handler_filter_many_to_one extends views_handler_filter_in_operator {
20

  
19 21
  /**
20 22
   * @var views_many_to_one_helper
21 23
   *
22 24
   * Stores the Helper object which handles the many_to_one complexity.
23 25
   */
24
  var $helper = NULL;
26
  public $helper = NULL;
25 27

  
26
  function init(&$view, &$options) {
28
  /**
29
   *
30
   */
31
  public $value_form_type = 'select';
32

  
33
  /**
34
   * {@inheritdoc}
35
   */
36
  public function init(&$view, &$options) {
27 37
    parent::init($view, $options);
28 38
    $this->helper = new views_many_to_one_helper($this);
29 39
  }
30 40

  
31
  function option_definition() {
41
  /**
42
   * {@inheritdoc}
43
   */
44
  public function option_definition() {
32 45
    $options = parent::option_definition();
33 46

  
34 47
    $options['operator']['default'] = 'or';
......
45 58
    return $options;
46 59
  }
47 60

  
48
  function operators() {
61
  /**
62
   * {@inheritdoc}
63
   */
64
  public function operators() {
49 65
    $operators = array(
50 66
      'or' => array(
51 67
        'title' => t('Is one of'),
......
93 109
    return $operators;
94 110
  }
95 111

  
96
  var $value_form_type = 'select';
97
  function value_form(&$form, &$form_state) {
112
  /**
113
   * {@inheritdoc}
114
   */
115
  public function value_form(&$form, &$form_state) {
98 116
    parent::value_form($form, $form_state);
99 117

  
100 118
    if (empty($form_state['exposed'])) {
......
106 124
   * Override ensure_my_table so we can control how this joins in.
107 125
   * The operator actually has influence over joining.
108 126
   */
109
  function ensure_my_table() {
127
  public function ensure_my_table() {
110 128
    // Defer to helper if the operator specifies it.
111 129
    $info = $this->operators();
112 130
    if (isset($info[$this->operator]['ensure_my_table']) && $info[$this->operator]['ensure_my_table'] == 'helper') {
......
116 134
    return parent::ensure_my_table();
117 135
  }
118 136

  
119
  function op_helper() {
137
  /**
138
   * {@inheritdoc}
139
   */
140
  public function op_helper() {
120 141
    if (empty($this->value)) {
121 142
      return;
122 143
    }
123 144
    $this->helper->add_filter();
124 145
  }
146

  
125 147
}

Formats disponibles : Unified diff