5use InvalidArgumentException;
32 parent::__construct( $params );
34 if ( isset( $params[
'placeholder-message'] ) ) {
35 $this->mPlaceholder = $this->
getMessage( $params[
'placeholder-message'] )->text();
36 } elseif ( isset( $params[
'placeholder'] ) ) {
37 $this->mPlaceholder = $params[
'placeholder'];
40 if ( isset( $params[
'useeditfont'] ) ) {
41 $this->mUseEditFont = $params[
'useeditfont'];
49 return $this->mParams[
'cols'] ?? static::DEFAULT_COLS;
56 return $this->mParams[
'rows'] ?? static::DEFAULT_ROWS;
63 $val = $this->mParams[
'spellcheck'] ??
null;
64 if ( is_bool( $val ) ) {
66 return $val ?
'true' :
'false';
85 if ( $this->mClass !==
'' ) {
88 if ( $this->mUseEditFont ) {
90 ->getUserOptionsLookup();
97 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
98 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
100 if ( $this->mPlaceholder !==
'' ) {
104 $attribs[
'class'] = $classes;
118 return Html::textarea( $this->mName, $value, $attribs );
128 if ( isset( $this->mParams[
'cols'] ) ) {
129 throw new InvalidArgumentException(
"OOUIHTMLForm does not support the 'cols' parameter for textareas" );
134 if ( $this->mClass !==
'' ) {
137 if ( $this->mUseEditFont ) {
139 ->getUserOptionsLookup();
146 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
147 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
149 if ( $this->mPlaceholder !==
'' ) {
152 if ( count( $classes ) ) {
153 $attribs[
'classes'] = $classes;
166 $attribs += \OOUI\Element::configFromHtmlAttributes(
170 return new \OOUI\MultilineTextInputWidget( [
172 'name' => $this->mName,
180 $textareaClasses = [
'cdx-text-area__textarea' ];
181 if ( $this->mClass !==
'' ) {
184 if ( $this->mUseEditFont ) {
186 ->getUserOptionsLookup();
193 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
194 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
202 'class' => $textareaClasses
205 if ( $this->mPlaceholder !==
'' ) {
220 $textarea = Html::textarea( $this->mName, $value, $textareaAttribs );
222 $wrapperAttribs = [
'class' => [
'cdx-text-area' ] ];
224 $wrapperAttribs[
'class'][] =
'cdx-text-area--status-error';
226 return Html::rawElement(
235class_alias( HTMLTextAreaField::class,
'HTMLTextAreaField' );
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself....
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.Defaults to false, which getOOUI will interpret as "...
getInputCodex( $value, $hasErrors)
Same as getInputHTML, but for Codex.This is called by CodexHTMLForm.If not overridden,...