jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/392541 )

Change subject: HTMLCompletionProfileSettings: Use OOUI radios when in OOUI form
......................................................................


HTMLCompletionProfileSettings: Use OOUI radios when in OOUI form

Bug: T180709
Change-Id: Ib3ff4e4c268e2e5aae4a0b8f1ca807a854e541d9
---
M includes/HTMLCompletionProfileSettings.php
1 file changed, 42 insertions(+), 22 deletions(-)

Approvals:
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/includes/HTMLCompletionProfileSettings.php 
b/includes/HTMLCompletionProfileSettings.php
index 2b2039e..cad7755 100644
--- a/includes/HTMLCompletionProfileSettings.php
+++ b/includes/HTMLCompletionProfileSettings.php
@@ -4,6 +4,8 @@
 
 use Html;
 use HTMLFormField;
+use OOUIHTMLForm;
+use OOUI;
 
 /**
  * Completion Suggester preferences UI.
@@ -76,28 +78,46 @@
         * @return string html
         */
        private function addCompSuggestOption( $prof, $value ) {
-               $html = Html::openElement( 'div' );
-               $html .= Html::openElement( 'div', [ 'style' => 
'vertical-align:top; display:inline-block;' ] );
-               $radioId = $this->mID . "-$prof";
-               $radioAttrs = [
-                       'id' => $radioId,
-               ];
-               if ( $prof === $value ) {
-                       $radioAttrs['checked'] = 'checked';
+               if ( $this->mParent instanceof OOUIHTMLForm ) {
+                       return new OOUI\FieldLayout(
+                               new OOUI\RadioInputWidget( [
+                                       'inputId' => $this->mID . "-$prof",
+                                       'name' => $this->mName,
+                                       'value' => $prof,
+                                       'selected' => $prof === $value,
+                               ] ),
+                               [
+                                       'align' => 'inline',
+                                       'label' => new OOUI\HtmlSnippet(
+                                               Html::element( 'strong', [], 
wfMessage( "cirrussearch-completion-profile-$prof-pref-name" )->text() )
+                                                       . '<br>' . wfMessage( 
"cirrussearch-completion-profile-$prof-pref-desc" )->escaped()
+                                       )
+                               ]
+                       );
+               } else {
+                       $html = Html::openElement( 'div' );
+                       $html .= Html::openElement( 'div', [ 'style' => 
'vertical-align:top; display:inline-block;' ] );
+                       $radioId = $this->mID . "-$prof";
+                       $radioAttrs = [
+                               'id' => $radioId,
+                       ];
+                       if ( $prof === $value ) {
+                               $radioAttrs['checked'] = 'checked';
+                       }
+                       $html .= Html::input( $this->mName, $prof, 'radio', 
$radioAttrs );
+                       $html .= Html::closeElement( 'div' );
+                       $html .= Html::openElement( 'div', [ 'style' => 
'display:inline-block; width: 90%' ] );
+                       $html .= Html::element( 'label',
+                               [ 'for' => $radioId, 'style' => 'font-weight: 
bold' ],
+                               wfMessage( 
"cirrussearch-completion-profile-$prof-pref-name" )->text()
+                       );
+                       $html .= Html::element( 'div',
+                               [],
+                               wfMessage( 
"cirrussearch-completion-profile-$prof-pref-desc" )->text()
+                       );
+                       $html .= Html::closeElement( 'div' );
+                       $html .= Html::closeElement( 'div' );
+                       return $html;
                }
-               $html .= Html::input( $this->mName, $prof, 'radio', $radioAttrs 
);
-               $html .= Html::closeElement( 'div' );
-               $html .= Html::openElement( 'div', [ 'style' => 
'display:inline-block; width: 90%' ] );
-               $html .= Html::element( 'label',
-                       [ 'for' => $radioId, 'style' => 'font-weight: bold' ],
-                       wfMessage( 
"cirrussearch-completion-profile-$prof-pref-name" )->text()
-               );
-               $html .= Html::element( 'div',
-                       [],
-                       wfMessage( 
"cirrussearch-completion-profile-$prof-pref-desc" )->text()
-               );
-               $html .= Html::closeElement( 'div' );
-               $html .= Html::closeElement( 'div' );
-               return $html;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/392541
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3ff4e4c268e2e5aae4a0b8f1ca807a854e541d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Cindy-the-browser-test-bot <bernhardsone...@gmail.com>
Gerrit-Reviewer: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Gehel <guillaume.leder...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Tjones <tjo...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to