From: Bartosz DziewoƄski Date: Mon, 3 Sep 2018 16:35:28 +0000 (+0200) Subject: HTMLInfoField: Support 'rawrow' in OOUI mode X-Git-Tag: 1.34.0-rc.0~3942^2 X-Git-Url: http://git.cyclocoop.org/%27http:/code.google.com/p/ie7-js/Category:Bar2?a=commitdiff_plain;h=e6eb87ae2028d9d3f9317d75cced42511ed97b9e;p=lhc%2Fweb%2Fwiklou.git HTMLInfoField: Support 'rawrow' in OOUI mode To be compatible with OOUIHTMLForm, 'default' must be a FieldLayout (or a subclass of FieldLayout) when using 'rawrow'. (Technically, it works when it's a string, but that's only by chance.) Bug: T203202 Change-Id: I571c619c32a806016b649562f5efe52ad45ef036 --- diff --git a/includes/htmlform/fields/HTMLInfoField.php b/includes/htmlform/fields/HTMLInfoField.php index 1376d0c86b..a98f11289d 100644 --- a/includes/htmlform/fields/HTMLInfoField.php +++ b/includes/htmlform/fields/HTMLInfoField.php @@ -75,6 +75,22 @@ class HTMLInfoField extends HTMLFormField { return parent::getRaw( $value ); } + /** + * @param mixed $value + * @return OOUI\FieldLayout + * @since 1.32 + */ + public function getOOUI( $value ) { + if ( !empty( $this->mParams['rawrow'] ) ) { + if ( !( $value instanceof OOUI\FieldLayout ) ) { + throw new Exception( "'default' must be a FieldLayout or subclass when using 'rawrow'" ); + } + return $value; + } + + return parent::getOOUI( $value ); + } + protected function needsLabel() { return false; }