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(),
14 ) +
$this->getTooltipAndAccessKey();
16 if ( $this->mClass
!== '' ) {
17 $attribs['class'] = $this->mClass
;
20 if ( !empty( $this->mParams
['disabled'] ) ) {
21 $attribs['disabled'] = 'disabled';
24 # @todo Enforce pattern, step, required, readonly on the server side as
26 $allowedParams = array(
36 foreach ( $allowedParams as $param ) {
37 if ( isset( $this->mParams
[$param] ) ) {
38 $attribs[$param] = $this->mParams
[$param];
42 foreach ( array( 'required', 'autofocus', 'multiple', 'readonly' ) as $param ) {
43 if ( isset( $this->mParams
[$param] ) ) {
44 $attribs[$param] = '';
48 # Implement tiny differences between some field variants
49 # here, rather than creating a new class for each one which
50 # is essentially just a clone of this one.
51 if ( isset( $this->mParams
['type'] ) ) {
52 switch ( $this->mParams
['type'] ) {
54 $attribs['type'] = 'email';
57 $attribs['type'] = 'number';
60 $attribs['type'] = 'number';
61 $attribs['step'] = 'any';
66 $attribs['type'] = $this->mParams
['type'];
71 return Html
::element( 'input', $attribs );