Merge "Don't run phpcs on node_modules folder"
[lhc/web/wiklou.git] / includes / htmlform / HTMLTextAreaField.php
1 <?php
2
3 class HTMLTextAreaField extends HTMLFormField {
4 const DEFAULT_COLS = 80;
5 const DEFAULT_ROWS = 25;
6
7 function getCols() {
8 return isset( $this->mParams['cols'] ) ? $this->mParams['cols'] : static::DEFAULT_COLS;
9 }
10
11 function getRows() {
12 return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS;
13 }
14
15 function getInputHTML( $value ) {
16 $attribs = array(
17 'id' => $this->mID,
18 'cols' => $this->getCols(),
19 'rows' => $this->getRows(),
20 ) + $this->getTooltipAndAccessKey();
21
22 if ( $this->mClass !== '' ) {
23 $attribs['class'] = $this->mClass;
24 }
25
26 $allowedParams = array(
27 'placeholder',
28 'tabindex',
29 'disabled',
30 'readonly',
31 'required',
32 'autofocus'
33 );
34
35 $attribs += $this->getAttributes( $allowedParams );
36 return Html::textarea( $this->mName, $value, $attribs );
37 }
38
39 function getInputOOUI( $value ) {
40 $attribs = $this->getTooltipAndAccessKey();
41
42 if ( $this->mClass !== '' ) {
43 $attribs['classes'] = array( $this->mClass );
44 }
45
46 $allowedParams = array(
47 'placeholder',
48 'tabindex',
49 'disabled',
50 'readonly',
51 'required',
52 'autofocus',
53 );
54
55 $attribs += $this->getAttributes( $allowedParams, array(
56 'tabindex' => 'tabIndex',
57 'readonly' => 'readOnly',
58 ) );
59
60 return new OOUI\TextInputWidget( array(
61 'id' => $this->mID,
62 'name' => $this->mName,
63 'multiline' => true,
64 'value' => $value,
65 ) + $attribs );
66 }
67 }