This provides better mobile experiences on various pages and a more consistent UI across both mobile and desktop. It does this in two ways. 1) Forces HTMLForms to not use table based layouts so as not to interfere with responsive nature of mediawiki ui elements 2) Applies MediaWiki.UI classes to most pages If a page is created via Xml or Html classes it will use mediawiki ui Where possible I've added classes unconditionally, but for cases of buttons this is behind the $wgUseMediaWikiUIEverywhere global since button styling is enabled on pages by default and for checkboxes since it is changes HTML markup. 3) Adds all MediaWiki.UI styles to pages which can use it When enabled: * Apply these styles to all pages which use HTMLForms * Apply to EditPage * Apply to anything that uses certain elements outputted by the Xml or HTML helper classes * Apply to History page * Apply to protection page * Apply to move page * Apply to deletion page Currently kept behind a global to allow us time to finetune existing elements. After further testing we will look to kill the globals and make mediawiki.ui the default See: I430c0fbb79d2a33bb828b2427bda0ee01115d73f Change-Id: I47db5eab4569514d039261d11b6dedb0eeae17b5
38 lines
842 B
PHP
38 lines
842 B
PHP
<?php
|
|
|
|
class HTMLTextAreaField extends HTMLFormField {
|
|
const DEFAULT_COLS = 80;
|
|
const DEFAULT_ROWS = 25;
|
|
|
|
function getCols() {
|
|
return isset( $this->mParams['cols'] ) ? $this->mParams['cols'] : static::DEFAULT_COLS;
|
|
}
|
|
|
|
function getRows() {
|
|
return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS;
|
|
}
|
|
|
|
function getInputHTML( $value ) {
|
|
$attribs = array(
|
|
'id' => $this->mID,
|
|
'cols' => $this->getCols(),
|
|
'rows' => $this->getRows(),
|
|
) + $this->getTooltipAndAccessKey();
|
|
|
|
if ( $this->mClass !== '' ) {
|
|
$attribs['class'] = $this->mClass;
|
|
}
|
|
|
|
$allowedParams = array(
|
|
'placeholder',
|
|
'tabindex',
|
|
'disabled',
|
|
'readonly',
|
|
'required',
|
|
'autofocus'
|
|
);
|
|
|
|
$attribs += $this->getAttributes( $allowedParams );
|
|
return Html::textarea( $this->mName, $value, $attribs );
|
|
}
|
|
}
|