X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLTextAreaField.php;h=ba9707dc34c2fc4eccce463b32de8f9c9deb048c;hb=62d54bed13ddee3355fd64946013bd3173465c16;hp=89e7be2e927ed9b452890664b359290c705467e0;hpb=91e41289558af817650354c6988a0708dc051e35;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLTextAreaField.php b/includes/htmlform/HTMLTextAreaField.php index 89e7be2e92..ba9707dc34 100644 --- a/includes/htmlform/HTMLTextAreaField.php +++ b/includes/htmlform/HTMLTextAreaField.php @@ -12,36 +12,37 @@ class HTMLTextAreaField extends HTMLFormField { return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS; } + function getSpellCheck() { + $val = isset( $this->mParams['spellcheck'] ) ? $this->mParams['spellcheck'] : null; + if( is_bool( $val ) ) { + // "spellcheck" attribute literally requires "true" or "false" to work. + return $val === true ? 'true' : 'false'; + } + return null; + } + function getInputHTML( $value ) { $attribs = array( 'id' => $this->mID, - 'name' => $this->mName, 'cols' => $this->getCols(), 'rows' => $this->getRows(), + 'spellcheck' => $this->getSpellCheck(), ) + $this->getTooltipAndAccessKey(); if ( $this->mClass !== '' ) { $attribs['class'] = $this->mClass; } - if ( !empty( $this->mParams['disabled'] ) ) { - $attribs['disabled'] = 'disabled'; - } - - if ( !empty( $this->mParams['readonly'] ) ) { - $attribs['readonly'] = 'readonly'; - } - - if ( isset( $this->mParams['placeholder'] ) ) { - $attribs['placeholder'] = $this->mParams['placeholder']; - } - - foreach ( array( 'required', 'autofocus' ) as $param ) { - if ( isset( $this->mParams[$param] ) ) { - $attribs[$param] = ''; - } - } - - return Html::element( 'textarea', $attribs, $value ); + $allowedParams = array( + 'placeholder', + 'tabindex', + 'disabled', + 'readonly', + 'required', + 'autofocus' + ); + + $attribs += $this->getAttributes( $allowedParams ); + return Html::textarea( $this->mName, $value, $attribs ); } }