Merge "Add &$tags argument to MarkPatrolled hook"
[lhc/web/wiklou.git] / includes / htmlform / HTMLForm.php
index 1a7f850..e5330b6 100644 (file)
@@ -159,6 +159,7 @@ class HTMLForm extends ContextSource {
                'checkmatrix' => HTMLCheckMatrix::class,
                'cloner' => HTMLFormFieldCloner::class,
                'autocompleteselect' => HTMLAutoCompleteSelectField::class,
+               'language' => HTMLSelectLanguageField::class,
                'date' => HTMLDateTimeField::class,
                'time' => HTMLDateTimeField::class,
                'datetime' => HTMLDateTimeField::class,
@@ -173,6 +174,7 @@ class HTMLForm extends ContextSource {
                'user' => HTMLUserTextField::class,
                'usersmultiselect' => HTMLUsersMultiselectField::class,
                'titlesmultiselect' => HTMLTitlesMultiselectField::class,
+               'namespacesmultiselect' => HTMLNamespacesMultiselectField::class,
        ];
 
        public $mFieldData;
@@ -231,6 +233,7 @@ class HTMLForm extends ContextSource {
        protected $mButtons = [];
 
        protected $mWrapperLegend = false;
+       protected $mWrapperAttributes = [];
 
        /**
         * Salt for the edit token.
@@ -524,7 +527,6 @@ class HTMLForm extends ContextSource {
        public function tryAuthorizedSubmit() {
                $result = false;
 
-               $identOkay = false;
                if ( $this->mFormIdentifier === null ) {
                        $identOkay = true;
                } else {
@@ -603,7 +605,7 @@ class HTMLForm extends ContextSource {
                $valid = true;
                $hoistedErrors = Status::newGood();
                if ( $this->mValidationErrorMessage ) {
-                       foreach ( (array)$this->mValidationErrorMessage as $error ) {
+                       foreach ( $this->mValidationErrorMessage as $error ) {
                                $hoistedErrors->fatal( ...$error );
                        }
                } else {
@@ -698,8 +700,8 @@ class HTMLForm extends ContextSource {
        /**
         * Set a message to display on a validation error.
         *
-        * @param string|array $msg String or Array of valid inputs to wfMessage()
-        *     (so each entry can be either a String or Array)
+        * @param array $msg Array of valid inputs to wfMessage()
+        *     (so each entry must itself be an array of arguments)
         *
         * @return HTMLForm $this for chaining calls (since 1.20)
         */
@@ -1087,7 +1089,7 @@ class HTMLForm extends ContextSource {
                # Include a <fieldset> wrapper for style, if requested.
                if ( $this->mWrapperLegend !== false ) {
                        $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend : false;
-                       $html = Xml::fieldset( $legend, $html );
+                       $html = Xml::fieldset( $legend, $html, $this->mWrapperAttributes );
                }
 
                return Html::rawElement(
@@ -1532,6 +1534,19 @@ class HTMLForm extends ContextSource {
                return $this;
        }
 
+       /**
+        * For internal use only. Use is discouraged, and should only be used where
+        * support for gadgets/user scripts is warranted.
+        * @param array $attributes
+        * @internal
+        * @return HTMLForm $this for chaining calls
+        */
+       public function setWrapperAttributes( $attributes ) {
+               $this->mWrapperAttributes = $attributes;
+
+               return $this;
+       }
+
        /**
         * Prompt the whole form to be wrapped in a "<fieldset>", with
         * this message as its "<legend>" element.