From 0355870e786dabc90f82f230ace9112ab8bb9f60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sun, 14 Jun 2015 20:17:09 +0200 Subject: [PATCH] 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 --- includes/htmlform/HTMLRadioField.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 = ''; -- 2.20.1