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

  
8 8
/**
9
 * Basic argument handler to implement string arguments that may have length
10
 * limits.
9
 * Argument handler to implement string arguments that may have length limits.
11 10
 *
12 11
 * @ingroup views_argument_handlers
13 12
 */
14 13
class views_handler_argument_string extends views_handler_argument {
15
  function init(&$view, &$options) {
14

  
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function init(&$view, &$options) {
16 19
    parent::init($view, $options);
17 20
    if (!empty($this->definition['many to one'])) {
18 21
      $this->helper = new views_many_to_one_helper($this);
19 22

  
20
      // Ensure defaults for these, during summaries and stuff:
23
      // Ensure defaults for these, during summaries and stuff.
21 24
      $this->operator = 'or';
22 25
      $this->value = array();
23 26
    }
24 27
  }
25 28

  
26
  function option_definition() {
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public function option_definition() {
27 33
    $options = parent::option_definition();
28 34

  
29 35
    $options['glossary'] = array('default' => FALSE, 'bool' => TRUE);
......
41 47
    return $options;
42 48
  }
43 49

  
44
  function options_form(&$form, &$form_state) {
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function options_form(&$form, &$form_state) {
45 54
    parent::options_form($form, $form_state);
46 55

  
47 56
    $form['glossary'] = array(
......
126 135
  }
127 136

  
128 137
  /**
129
   * Build the summary query based on a string
138
   * Build the summary query based on a string.
130 139
   */
131
  function summary_query() {
140
  public function summary_query() {
132 141
    if (empty($this->definition['many to one'])) {
133 142
      $this->ensure_my_table();
134 143
    }
......
157 166
   *
158 167
   * $this->ensure_my_table() MUST have been called prior to this.
159 168
   */
160
  function get_formula() {
169
  public function get_formula() {
161 170
    return "SUBSTRING($this->table_alias.$this->real_field, 1, " . intval($this->options['limit']) . ")";
162 171
  }
163 172

  
164 173
  /**
165 174
   * Build the query based upon the formula
166 175
   */
167
  function query($group_by = FALSE) {
176
  public function query($group_by = FALSE) {
168 177
    $argument = $this->argument;
169 178
    if (!empty($this->options['transform_dash'])) {
170 179
      $argument = strtr($argument, '-', ' ');
......
223 232
    }
224 233
  }
225 234

  
226
  function summary_argument($data) {
235
  /**
236
   * {@inheritdoc}
237
   */
238
  public function summary_argument($data) {
227 239
    $value = $this->case_transform($data->{$this->base_alias}, $this->options['path_case']);
228 240
    if (!empty($this->options['transform_dash'])) {
229 241
      $value = strtr($value, ' ', '-');
......
231 243
    return $value;
232 244
  }
233 245

  
234
  function get_sort_name() {
246
  /**
247
   * {@inheritdoc}
248
   */
249
  public function get_sort_name() {
235 250
    return t('Alphabetical', array(), array('context' => 'Sort order'));
236 251
  }
237 252

  
238
  function title() {
253
  /**
254
   * {@inheritdoc}
255
   */
256
  public function title() {
239 257
    $this->argument = $this->case_transform($this->argument, $this->options['case']);
240 258
    if (!empty($this->options['transform_dash'])) {
241 259
      $this->argument = strtr($this->argument, '-', ' ');
......
263 281
  /**
264 282
   * Override for specific title lookups.
265 283
   */
266
  function title_query() {
284
  public function title_query() {
267 285
    return drupal_map_assoc($this->value, 'check_plain');
268 286
  }
269 287

  
270
  function summary_name($data) {
288
  /**
289
   * {@inheritdoc}
290
   */
291
  public function summary_name($data) {
271 292
    return $this->case_transform(parent::summary_name($data), $this->options['case']);
272 293
  }
273 294

  

Formats disponibles : Unified diff