Merge "Make showDiffPage() protected"
[lhc/web/wiklou.git] / includes / htmlform / HTMLFormField.php
index 11b88b4..645b507 100644 (file)
@@ -13,6 +13,7 @@ abstract class HTMLFormField {
        protected $mLabel; # String label.  Set on construction
        protected $mID;
        protected $mClass = '';
+       protected $mVFormClass = '';
        protected $mHelpClass = false;
        protected $mDefault;
        protected $mOptions = false;
@@ -218,7 +219,7 @@ abstract class HTMLFormField {
                                default:
                                        throw new MWException( "Unknown operation" );
                        }
-               } catch ( MWException $ex ) {
+               } catch ( Exception $ex ) {
                        throw new MWException(
                                "Invalid hide-if specification for $this->mName: " .
                                $ex->getMessage() . " in " . var_export( $origParams, true ),
@@ -512,10 +513,7 @@ abstract class HTMLFormField {
                        array( 'class' => $outerDivClass ) + $cellAttributes,
                        $inputHtml . "\n$errors"
                );
-               $divCssClasses = array( "mw-htmlform-field-$fieldType", $this->mClass, $errorClass );
-               if ( $this->mParent->isVForm() ) {
-                       $divCssClasses[] = 'mw-ui-vform-field';
-               }
+               $divCssClasses = array( "mw-htmlform-field-$fieldType", $this->mClass, $this->mVFormClass, $errorClass );
 
                $wrapperAttributes = array(
                        'class' => $divCssClasses,
@@ -554,6 +552,20 @@ abstract class HTMLFormField {
                return $html;
        }
 
+       /**
+        * Get the complete field for the input, including help text,
+        * labels, and whatever. Fall back from 'vform' to 'div' when not overridden.
+        *
+        * @since 1.25
+        * @param string $value The value to set the input to.
+        * @return string Complete HTML field.
+        */
+       public function getVForm( $value ) {
+               // Ewwww
+               $this->mVFormClass = ' mw-ui-vform-field';
+               return $this->getDiv( $value );
+       }
+
        /**
         * Generate help text HTML in table format
         * @since 1.20