protected $mButtons = [];
protected $mWrapperLegend = false;
+ protected $mWrapperAttributes = [];
/**
* Salt for the edit token.
public function tryAuthorizedSubmit() {
$result = false;
- $identOkay = false;
if ( $this->mFormIdentifier === null ) {
$identOkay = true;
} else {
$valid = true;
$hoistedErrors = Status::newGood();
if ( $this->mValidationErrorMessage ) {
- foreach ( (array)$this->mValidationErrorMessage as $error ) {
+ foreach ( $this->mValidationErrorMessage as $error ) {
$hoistedErrors->fatal( ...$error );
}
} else {
/**
* 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)
*/
# 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(
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.