13 return $this->mParams[
'size'] ?? 20;
18 $p = parent::validate( $value, $alldata );
24 $value = trim( $value ??
'' );
25 if ( $value ===
'' ) {
30 # with the addition that a leading '+' sign is ok.
31 if ( !preg_match(
'/^((\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?)?$/i', $value ) ) {
32 return $this->
msg(
'htmlform-float-invalid' );
35 # The "int" part of these message names is rather confusing.
36 # They make equal sense for all numbers.
37 if ( isset( $this->mParams[
'min'] ) ) {
38 $min = $this->mParams[
'min'];
40 if ( $min > $value ) {
41 return $this->
msg(
'htmlform-int-toolow', $min );
45 if ( isset( $this->mParams[
'max'] ) ) {
46 $max = $this->mParams[
'max'];
48 if ( $max < $value ) {
49 return $this->
msg(
'htmlform-int-toohigh', $max );
61 return new \OOUI\NumberInputWidget( $params );
66class_alias( HTMLFloatField::class,
'HTMLFloatField' );