3 namespace MediaWiki\HTMLForm\Field
;
6 * A limit dropdown, which accepts any valid number
10 class HTMLSelectLimitField
extends HTMLSelectField
{
12 * Basically don't do any validation. If it's a number that's fine. Also,
13 * add it to the list if it's not there already
15 * @param string $value
16 * @param array $alldata
19 public function validate( $value, $alldata ) {
24 // Let folks pick an explicit limit not from our list, as long as it's a real number.
25 if ( !in_array( $value, $this->mParams
['options'] )
26 && $value == intval( $value )
29 // This adds the explicitly requested limit value to the drop-down,
30 // then makes sure it's sorted correctly so when we output the list
31 // later, the custom option doesn't just show up last.
32 $this->mParams
['options'][$this->mParent
->getLanguage()->formatNum( $value )] =
34 asort( $this->mParams
['options'] );
41 /** @deprecated class alias since 1.42 */
42 class_alias( HTMLSelectLimitField
::class, 'HTMLSelectLimitField' );