From e6eb87ae2028d9d3f9317d75cced42511ed97b9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 3 Sep 2018 18:35:28 +0200 Subject: [PATCH] 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 --- includes/htmlform/fields/HTMLInfoField.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; } -- 2.20.1