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 number.
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 }
A select dropdown field.
A limit dropdown, which accepts any valid number.
validate( $value, $alldata)
Basically don't do any validation.