MediaWiki  master
HTMLSelectLimitField.php
Go to the documentation of this file.
1 <?php
2 
17  public function validate( $value, $alldata ) {
18  if ( $value == '' ) {
19  return true;
20  }
21 
22  // Let folks pick an explicit limit not from our list, as long as it's a real numbr.
23  if ( !in_array( $value, $this->mParams['options'] )
24  && $value == intval( $value )
25  && $value > 0
26  ) {
27  // This adds the explicitly requested limit value to the drop-down,
28  // then makes sure it's sorted correctly so when we output the list
29  // later, the custom option doesn't just show up last.
30  $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] =
31  intval( $value );
32  asort( $this->mParams['options'] );
33  }
34 
35  return true;
36  }
37 }
HTMLSelectField
A select dropdown field.
Definition: HTMLSelectField.php:8
HTMLSelectLimitField
A limit dropdown, which accepts any valid number.
Definition: HTMLSelectLimitField.php:8
HTMLSelectLimitField\validate
validate( $value, $alldata)
Basically don't do any validation.
Definition: HTMLSelectLimitField.php:17