5use InvalidArgumentException;
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'];
46 return $this->mParams[
'cols'] ?? static::DEFAULT_COLS;
50 return $this->mParams[
'rows'] ?? static::DEFAULT_ROWS;
54 $val = $this->mParams[
'spellcheck'] ??
null;
55 if ( is_bool( $val ) ) {
57 return $val ?
'true' :
'false';
76 if ( $this->mClass !==
'' ) {
79 if ( $this->mUseEditFont ) {
81 ->getUserOptionsLookup();
88 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
89 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
91 if ( $this->mPlaceholder !==
'' ) {
95 $attribs[
'class'] = $classes;
109 return Html::textarea( $this->mName, $value, $attribs );
119 if ( isset( $this->mParams[
'cols'] ) ) {
120 throw new InvalidArgumentException(
"OOUIHTMLForm does not support the 'cols' parameter for textareas" );
125 if ( $this->mClass !==
'' ) {
128 if ( $this->mUseEditFont ) {
130 ->getUserOptionsLookup();
137 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
138 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
140 if ( $this->mPlaceholder !==
'' ) {
143 if ( count( $classes ) ) {
144 $attribs[
'classes'] = $classes;
157 $attribs += \OOUI\Element::configFromHtmlAttributes(
161 return new \OOUI\MultilineTextInputWidget( [
163 'name' => $this->mName,
170 $textareaClasses = [
'cdx-text-area__textarea' ];
171 if ( $this->mClass !==
'' ) {
174 if ( $this->mUseEditFont ) {
176 ->getUserOptionsLookup();
183 $userOptionsLookup->
getOption( $this->mParent->getUser(),
'editfont' );
184 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
192 'class' => $textareaClasses
195 if ( $this->mPlaceholder !==
'' ) {
210 $textarea = Html::textarea( $this->mName, $value, $textareaAttribs );
212 $wrapperAttribs = [
'class' => [
'cdx-text-area' ] ];
214 $wrapperAttribs[
'class'][] =
'cdx-text-area--status-error';
216 return Html::rawElement(
225class_alias( HTMLTextAreaField::class,
'HTMLTextAreaField' );
array $params
The job parameters.
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.