2013-11-19 12:55:50 +00:00
|
|
|
<?php
|
2013-11-19 13:08:16 +00:00
|
|
|
|
2013-11-19 12:55:50 +00:00
|
|
|
class HTMLTextAreaField extends HTMLFormField {
|
|
|
|
|
const DEFAULT_COLS = 80;
|
|
|
|
|
const DEFAULT_ROWS = 25;
|
|
|
|
|
|
|
|
|
|
function getCols() {
|
2013-11-19 13:08:16 +00:00
|
|
|
return isset( $this->mParams['cols'] ) ? $this->mParams['cols'] : static::DEFAULT_COLS;
|
2013-11-19 12:55:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getRows() {
|
2013-11-19 13:08:16 +00:00
|
|
|
return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS;
|
2013-11-19 12:55:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getInputHTML( $value ) {
|
|
|
|
|
$attribs = array(
|
|
|
|
|
'id' => $this->mID,
|
|
|
|
|
'name' => $this->mName,
|
|
|
|
|
'cols' => $this->getCols(),
|
|
|
|
|
'rows' => $this->getRows(),
|
|
|
|
|
) + $this->getTooltipAndAccessKey();
|
|
|
|
|
|
|
|
|
|
if ( $this->mClass !== '' ) {
|
2013-11-19 13:08:16 +00:00
|
|
|
$attribs['class'] = $this->mClass;
|
2013-11-19 12:55:50 +00:00
|
|
|
}
|
|
|
|
|
|
2013-05-02 18:27:44 +00:00
|
|
|
$allowedParams = array(
|
|
|
|
|
'placeholder',
|
|
|
|
|
'tabindex',
|
|
|
|
|
'disabled',
|
|
|
|
|
'readonly',
|
|
|
|
|
'required',
|
|
|
|
|
'autofocus'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$attribs += $this->getAttributes( $allowedParams );
|
2013-11-19 12:55:50 +00:00
|
|
|
|
|
|
|
|
return Html::element( 'textarea', $attribs, $value );
|
|
|
|
|
}
|
2013-11-19 13:08:16 +00:00
|
|
|
}
|