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