Merge "Show ParserOutput warning instead of on the actual page output for ignored...
[lhc/web/wiklou.git] / includes / htmlform / HTMLRadioField.php
index ecca6ff..9d3cc13 100644 (file)
@@ -53,10 +53,14 @@ class HTMLRadioField extends HTMLFormField {
                        'value' => $value,
                        'options' => $options,
                        'classes' => 'mw-htmlform-flatlist-item',
-               ] + $this->getAttributes( [ 'disabled', 'tabindex' ], [ 'tabindex' => 'tabIndex' ] ) );
+               ] + OOUI\Element::configFromHtmlAttributes(
+                       $this->getAttributes( [ 'disabled', 'tabindex' ] )
+               ) );
        }
 
        function formatOptions( $options, $value ) {
+               global $wgUseMediaWikiUIEverywhere;
+
                $html = '';
 
                $attribs = $this->getAttributes( [ 'disabled', 'tabindex' ] );
@@ -69,12 +73,16 @@ class HTMLRadioField extends HTMLFormField {
                                $html .= $this->formatOptions( $info, $value );
                        } else {
                                $id = Sanitizer::escapeId( $this->mID . "-$info" );
+                               $classes = [ 'mw-htmlform-flatlist-item' ];
+                               if ( $wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm ) {
+                                       $classes[] = 'mw-ui-radio';
+                               }
                                $radio = Xml::radio( $this->mName, $info, $info === $value, $attribs + [ 'id' => $id ] );
                                $radio .= ' ' . call_user_func( $elementFunc, 'label', [ 'for' => $id ], $label );
 
                                $html .= ' ' . Html::rawElement(
                                        'div',
-                                       [ 'class' => 'mw-htmlform-flatlist-item mw-ui-radio' ],
+                                       [ 'class' => $classes ],
                                        $radio
                                );
                        }