From: Bartosz DziewoƄski Date: Sun, 14 Jun 2015 18:17:09 +0000 (+0200) Subject: OOUIHTMLForm: Implement HTMLRadioField X-Git-Tag: 1.31.0-rc.0~10942^2~2 X-Git-Url: http://git.cyclocoop.org/%27%20.%20%24prefix%20.%20Wiki::transformTitleToURI%28%24matches%5B1%5D%29%20.%20%27?a=commitdiff_plain;h=0355870e786dabc90f82f230ace9112ab8bb9f60;p=lhc%2Fweb%2Fwiklou.git OOUIHTMLForm: Implement HTMLRadioField Example usage in I2c3d6486e09b3e4d5537b95194e178fd73ac9792 (Special:PageLanguage). Trivial now that we have RadioSelectInputWidget in OOUI (added in fd2815e372f6a4beb4f4e5f2a7d9cbf785d40851). Depends on If68f04a2fa20e7c03763898ab80cf39b5e6cb182 in OOUI. Bug: T98855 Change-Id: I224e591e58534c07af62eebb9ae4b185225edc33 --- diff --git a/includes/htmlform/HTMLRadioField.php b/includes/htmlform/HTMLRadioField.php index 0f00540890..19b45bea17 100644 --- a/includes/htmlform/HTMLRadioField.php +++ b/includes/htmlform/HTMLRadioField.php @@ -38,6 +38,23 @@ class HTMLRadioField extends HTMLFormField { return $html; } + function getInputOOUI( $value ) { + $options = array(); + foreach ( $this->getOptions() as $label => $value ) { + $options[] = array( + 'data' => $value, + 'label' => $this->mOptionsLabelsNotFromMessage ? new OOUI\HtmlSnippet( $label ) : $label, + ); + } + + return new OOUI\RadioSelectInputWidget( array( + 'name' => $this->mName, + 'value' => $value, + 'options' => $options, + 'classes' => 'mw-htmlform-flatlist-item', + ) + $this->getAttributes( array( 'disabled', 'tabindex' ), array( 'tabindex' => 'tabIndex' ) ) ); + } + function formatOptions( $options, $value ) { $html = '';