5use InvalidArgumentException;
32 if ( isset(
$params[
'placeholder-message'] ) ) {
33 $this->mPlaceholder = $this->
getMessage(
$params[
'placeholder-message'] )->text();
34 } elseif ( isset(
$params[
'placeholder'] ) ) {
35 $this->mPlaceholder =
$params[
'placeholder'];
38 if ( isset(
$params[
'useeditfont'] ) ) {
39 $this->mUseEditFont =
$params[
'useeditfont'];
44 return $this->mParams[
'cols'] ?? static::DEFAULT_COLS;
48 return $this->mParams[
'rows'] ?? static::DEFAULT_ROWS;
52 $val = $this->mParams[
'spellcheck'] ??
null;
53 if ( is_bool( $val ) ) {
55 return $val ?
'true' :
'false';
74 if ( $this->mClass !==
'' ) {
77 if ( $this->mUseEditFont ) {
79 ->getUserOptionsLookup();
86 $userOptionsLookup->getOption( $this->mParent->getUser(),
'editfont' );
87 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
89 if ( $this->mPlaceholder !==
'' ) {
93 $attribs[
'class'] = $classes;
107 return Html::textarea( $this->mName, $value, $attribs );
117 if ( isset( $this->mParams[
'cols'] ) ) {
118 throw new InvalidArgumentException(
"OOUIHTMLForm does not support the 'cols' parameter for textareas" );
123 if ( $this->mClass !==
'' ) {
126 if ( $this->mUseEditFont ) {
128 ->getUserOptionsLookup();
135 $userOptionsLookup->getOption( $this->mParent->getUser(),
'editfont' );
136 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
138 if ( $this->mPlaceholder !==
'' ) {
141 if ( count( $classes ) ) {
142 $attribs[
'classes'] = $classes;
155 $attribs += \OOUI\Element::configFromHtmlAttributes(
159 return new \OOUI\MultilineTextInputWidget( [
161 'name' => $this->mName,
168 $textareaClasses = [
'cdx-text-area__textarea' ];
169 if ( $this->mClass !==
'' ) {
172 if ( $this->mUseEditFont ) {
174 ->getUserOptionsLookup();
181 $userOptionsLookup->getOption( $this->mParent->getUser(),
'editfont' );
182 $this->mParent->getOutput()->addModuleStyles(
'mediawiki.editfont.styles' );
190 'class' => $textareaClasses
193 if ( $this->mPlaceholder !==
'' ) {
208 $textarea = Html::textarea( $this->mName, $value, $textareaAttribs );
210 $wrapperAttribs = [
'class' => [
'cdx-text-area' ] ];
212 $wrapperAttribs[
'class'][] =
'cdx-text-area--status-error';
214 return Html::rawElement(
223class_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.