Merge "ApiQueryAllUsers: Set 'array' type on result arrays"
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 645b507..0c3fe44 100644 (file)
@@ -10,6 +10,7 @@ abstract class HTMLFormField {
        protected $mValidationCallback;
        protected $mFilterCallback;
        protected $mName;
+       protected $mDir;
        protected $mLabel; # String label.  Set on construction
        protected $mID;
        protected $mClass = '';
@@ -377,6 +378,10 @@ abstract class HTMLFormField {
                        $this->mName = $params['name'];
                }
 
+               if ( isset( $params['dir'] ) ) {
+                       $this->mDir = $params['dir'];
+               }
+
                $validName = Sanitizer::escapeId( $this->mName );
                $validName = str_replace( array( '.5B', '.5D' ), array( '[', ']' ), $validName );
                if ( $this->mName != $validName && !isset( $params['nodata'] ) ) {
@@ -566,6 +571,27 @@ abstract class HTMLFormField {
                return $this->getDiv( $value );
        }
 
+       /**
+        * Get the complete field as an inline element.
+        * @since 1.25
+        * @param string $value The value to set the input to.
+        * @return string Complete HTML inline element
+        */
+       public function getInline( $value ) {
+               list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
+               $inputHtml = $this->getInputHTML( $value );
+               $helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
+               $cellAttributes = array();
+               $label = $this->getLabelHtml( $cellAttributes );
+
+               $html = "\n" . $errors .
+                       $label . ' ' .
+                       $inputHtml .
+                       $helptext;
+
+               return $html;
+       }
+
        /**
         * Generate help text HTML in table format
         * @since 1.20