wiki.techinc.nl/includes/htmlform/HTMLTextAreaField.php
Alexandre Emsenhuber cb9a9a7b47 Add support for "tabindex" in HTMLFormField subclasses
It is already set for some fields in Special:Block, but are
discarded by HTMLForm and its fields.

Some notes:
- fields with multiple inputs (radio, select and other, select
  or other) will have the same tabindex set on all elements
- Some items such as multi-select and check matrix are not yet
  implemented

Change-Id: I3e1ba7f16f3a3183f231afcf60dd392ce6d6eb6b
2014-01-25 04:31:01 +00:00

40 lines
868 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,
'name' => $this->mName,
'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::element( 'textarea', $attribs, $value );
}
}