Merge "Remove silly 'm' prefix from StubObject/DeprecatedGlobal members"
[lhc/web/wiklou.git] / includes / htmlform / HTMLTextAreaField.php
index f9a6df0..4fd1989 100644 (file)
@@ -1,14 +1,15 @@
 <?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;
+               return isset( $this->mParams['cols'] ) ? $this->mParams['cols'] : static::DEFAULT_COLS;
        }
 
        function getRows() {
-               return isset( $this->mParams[ 'rows' ] ) ? $this->mParams[ 'rows' ] : static::DEFAULT_ROWS;
+               return isset( $this->mParams['rows'] ) ? $this->mParams['rows'] : static::DEFAULT_ROWS;
        }
 
        function getInputHTML( $value ) {
@@ -20,27 +21,20 @@ class HTMLTextAreaField extends HTMLFormField {
                        ) + $this->getTooltipAndAccessKey();
 
                if ( $this->mClass !== '' ) {
-                       $attribs[ 'class' ] = $this->mClass;
-               }
-
-               if ( ! empty( $this->mParams[ 'disabled' ] ) ) {
-                       $attribs[ 'disabled' ] = 'disabled';
+                       $attribs['class'] = $this->mClass;
                }
 
-               if ( ! empty( $this->mParams[ 'readonly' ] ) ) {
-                       $attribs[ 'readonly' ] = 'readonly';
-               }
+               $allowedParams = array(
+                       'placeholder',
+                       'tabindex',
+                       'disabled',
+                       'readonly',
+                       'required',
+                       'autofocus'
+               );
 
-               if ( isset( $this->mParams[ 'placeholder' ] ) ) {
-                       $attribs[ 'placeholder' ] = $this->mParams[ 'placeholder' ];
-               }
-
-               foreach ( array( 'required', 'autofocus' ) as $param ) {
-                       if ( isset( $this->mParams[ $param ] ) ) {
-                               $attribs[ $param ] = '';
-                       }
-               }
+               $attribs += $this->getAttributes( $allowedParams );
 
                return Html::element( 'textarea', $attribs, $value );
        }
-}
\ No newline at end of file
+}