3 class HTMLTextAreaField
extends HTMLFormField
{
4 const DEFAULT_COLS
= 80;
5 const DEFAULT_ROWS
= 25;
8 return isset( $this->mParams
['cols'] ) ?
$this->mParams
['cols'] : static::DEFAULT_COLS
;
12 return isset( $this->mParams
['rows'] ) ?
$this->mParams
['rows'] : static::DEFAULT_ROWS
;
15 function getSpellCheck() {
16 $val = isset( $this->mParams
['spellcheck'] ) ?
$this->mParams
['spellcheck'] : null;
17 if ( is_bool( $val ) ) {
18 // "spellcheck" attribute literally requires "true" or "false" to work.
19 return $val === true ?
'true' : 'false';
24 function getInputHTML( $value ) {
27 'cols' => $this->getCols(),
28 'rows' => $this->getRows(),
29 'spellcheck' => $this->getSpellCheck(),
30 ) +
$this->getTooltipAndAccessKey();
32 if ( $this->mClass
!== '' ) {
33 $attribs['class'] = $this->mClass
;
36 $allowedParams = array(
45 $attribs +
= $this->getAttributes( $allowedParams );
46 return Html
::textarea( $this->mName
, $value, $attribs );
49 function getInputOOUI( $value ) {
50 if ( isset( $this->mParams
['cols'] ) ) {
51 throw new Exception( "OOUIHTMLForm does not support the 'cols' parameter for textareas" );
54 $attribs = $this->getTooltipAndAccessKey();
56 if ( $this->mClass
!== '' ) {
57 $attribs['classes'] = array( $this->mClass
);
60 $allowedParams = array(
69 $attribs +
= $this->getAttributes( $allowedParams, array(
70 'tabindex' => 'tabIndex',
71 'readonly' => 'readOnly',
74 return new OOUI\
TextInputWidget( array(
76 'name' => $this->mName
,
79 'rows' => $this->getRows(),