3 class HTMLTextField
extends HTMLFormField
{
5 return isset( $this->mParams
['size'] ) ?
$this->mParams
['size'] : 45;
8 function getInputHTML( $value ) {
11 'name' => $this->mName
,
12 'size' => $this->getSize(),
15 ) +
$this->getTooltipAndAccessKey();
17 if ( $this->mClass
!== '' ) {
18 $attribs['class'] = $this->mClass
;
21 # @todo Enforce pattern, step, required, readonly on the server side as
23 $allowedParams = array(
41 $attribs +
= $this->getAttributes( $allowedParams );
44 $type = $this->getType( $attribs );
45 return Html
::input( $this->mName
, $value, $type, $attribs );
48 protected function getType( &$attribs ) {
49 $type = isset( $attribs['type'] ) ?
$attribs['type'] : 'text';
50 unset( $attribs['type'] );
52 # Implement tiny differences between some field variants
53 # here, rather than creating a new class for each one which
54 # is essentially just a clone of this one.
55 if ( isset( $this->mParams
['type'] ) ) {
56 switch ( $this->mParams
['type'] ) {
62 $attribs['step'] = 'any';
69 $type = $this->mParams
['type'];
77 function getInputOOUI( $value ) {
78 $attribs = $this->getTooltipAndAccessKey();
80 if ( $this->mClass
!== '' ) {
81 $attribs['classes'] = array( $this->mClass
);
84 # @todo Enforce pattern, step, required, readonly on the server side as
86 $allowedParams = array(
100 $attribs +
= $this->getAttributes( $allowedParams, array(
101 'maxlength' => 'maxLength',
102 'readonly' => 'readOnly',
103 'tabindex' => 'tabIndex',
106 $type = $this->getType( $attribs );
108 return new OOUI\
TextInputWidget( array(
110 'name' => $this->mName
,