10 return $this->mParams[
'size'] ?? 20;
14 $p = parent::validate( $value, $alldata );
20 $value = trim( $value ??
'' );
21 if ( $value ===
'' ) {
26 # with the addition that a leading '+' sign is ok.
27 if ( !preg_match(
'/^((\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?)?$/i', $value ) ) {
28 return $this->
msg(
'htmlform-float-invalid' );
31 # The "int" part of these message names is rather confusing.
32 # They make equal sense for all numbers.
33 if ( isset( $this->mParams[
'min'] ) ) {
34 $min = $this->mParams[
'min'];
36 if ( $min > $value ) {
37 return $this->
msg(
'htmlform-int-toolow', $min );
41 if ( isset( $this->mParams[
'max'] ) ) {
42 $max = $this->mParams[
'max'];
44 if ( $max < $value ) {
45 return $this->
msg(
'htmlform-int-toohigh', $max );
57 return new OOUI\NumberInputWidget( $params );
A field that will contain a numeric value.
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
getInputWidget( $params)
to overrideWidget