Change-Id: I7c76e911b4d71842b49272186e880051eee8de2b
const DEFAULT_ROWS = 25;
protected $mPlaceholder = '';
const DEFAULT_ROWS = 25;
protected $mPlaceholder = '';
+ protected $mUseEditFont = false;
/**
* @param array $params
* - cols, rows: textarea size
* - placeholder/placeholder-message: set HTML placeholder attribute
* - spellcheck: set HTML spellcheck attribute
/**
* @param array $params
* - cols, rows: textarea size
* - placeholder/placeholder-message: set HTML placeholder attribute
* - spellcheck: set HTML spellcheck attribute
+ * - useeditfont: add CSS classes to use the same font as the wikitext editor
*/
public function __construct( $params ) {
parent::__construct( $params );
*/
public function __construct( $params ) {
parent::__construct( $params );
} elseif ( isset( $params['placeholder'] ) ) {
$this->mPlaceholder = $params['placeholder'];
}
} elseif ( isset( $params['placeholder'] ) ) {
$this->mPlaceholder = $params['placeholder'];
}
+
+ if ( isset( $params['useeditfont'] ) ) {
+ $this->mUseEditFont = $params['useeditfont'];
+ }
}
public function getCols() {
}
public function getCols() {
}
public function getInputHTML( $value ) {
}
public function getInputHTML( $value ) {
$attribs = [
'id' => $this->mID,
'cols' => $this->getCols(),
$attribs = [
'id' => $this->mID,
'cols' => $this->getCols(),
] + $this->getTooltipAndAccessKey();
if ( $this->mClass !== '' ) {
] + $this->getTooltipAndAccessKey();
if ( $this->mClass !== '' ) {
- $attribs['class'] = $this->mClass;
+ array_push( $classes, $this->mClass );
+ }
+ if ( $this->mUseEditFont ) {
+ // The following classes can be used here:
+ // * mw-editfont-monospace
+ // * mw-editfont-sans-serif
+ // * mw-editfont-serif
+ array_push(
+ $classes,
+ 'mw-editfont-' . $this->mParent->getUser()->getOption( 'editfont' )
+ );
+ $this->mParent->getOutput()->addModuleStyles( 'mediawiki.editfont.styles' );
}
if ( $this->mPlaceholder !== '' ) {
$attribs['placeholder'] = $this->mPlaceholder;
}
}
if ( $this->mPlaceholder !== '' ) {
$attribs['placeholder'] = $this->mPlaceholder;
}
+ if ( count( $classes ) ) {
+ $attribs['class'] = implode( ' ', $classes );
+ }
$allowedParams = [
'tabindex',
$allowedParams = [
'tabindex',
}
function getInputOOUI( $value ) {
}
function getInputOOUI( $value ) {
if ( isset( $this->mParams['cols'] ) ) {
throw new Exception( "OOUIHTMLForm does not support the 'cols' parameter for textareas" );
}
if ( isset( $this->mParams['cols'] ) ) {
throw new Exception( "OOUIHTMLForm does not support the 'cols' parameter for textareas" );
}
$attribs = $this->getTooltipAndAccessKeyOOUI();
if ( $this->mClass !== '' ) {
$attribs = $this->getTooltipAndAccessKeyOOUI();
if ( $this->mClass !== '' ) {
- $attribs['classes'] = [ $this->mClass ];
+ array_push( $classes, $this->mClass );
+ }
+ if ( $this->mUseEditFont ) {
+ // The following classes can be used here:
+ // * mw-editfont-monospace
+ // * mw-editfont-sans-serif
+ // * mw-editfont-serif
+ array_push(
+ $classes,
+ 'mw-editfont-' . $this->mParent->getUser()->getOption( 'editfont' )
+ );
+ $this->mParent->getOutput()->addModuleStyles( 'mediawiki.editfont.styles' );
}
if ( $this->mPlaceholder !== '' ) {
$attribs['placeholder'] = $this->mPlaceholder;
}
}
if ( $this->mPlaceholder !== '' ) {
$attribs['placeholder'] = $this->mPlaceholder;
}
+ if ( count( $classes ) ) {
+ $attribs['classes'] = $classes;
+ }
$allowedParams = [
'tabindex',
$allowedParams = [
'tabindex',
'rows' => 10,
'default' => $input,
'id' => 'input',
'rows' => 10,
'default' => $input,
'id' => 'input',
- // The following classes can be used here:
- // * mw-editfont-monospace
- // * mw-editfont-sans-serif
- // * mw-editfont-serif
- 'cssclass' => 'mw-editfont-' . $this->getUser()->getOption( 'editfont' ),
],
'removecomments' => [
'type' => 'check',
],
'removecomments' => [
'type' => 'check',
- $this->getOutput()->addModuleStyles( 'mediawiki.editfont.styles' );
-
$form = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
$form
->setSubmitTextMsg( 'expand_templates_ok' )
$form = HTMLForm::factory( 'ooui', $fields, $this->getContext() );
$form
->setSubmitTextMsg( 'expand_templates_ok' )