Convert Special:WithoutInterwiki to HTMLForm
authortonythomas01 <01tonythomas@gmail.com>
Sun, 17 Apr 2016 09:06:07 +0000 (14:36 +0530)
committertonythomas01 <01tonythomas@gmail.com>
Tue, 19 Apr 2016 05:05:48 +0000 (10:35 +0530)
TODO: Should be eventually converted to OOUI

Bug: T117721
Change-Id: I56b6b78b53d2531ebdb9cd0f903a4ce475dbc56b

includes/specials/SpecialWithoutinterwiki.php

index e2052b9..cca54b3 100644 (file)
@@ -46,23 +46,23 @@ class WithoutInterwikiPage extends PageQueryPage {
                        return '';
                }
 
-               $prefix = $this->prefix;
-               $t = $this->getPageTitle();
+               $formDescriptor = [
+                       'prefix' => [
+                               'label-message' => 'allpagesprefix',
+                               'name' => 'prefix',
+                               'id' => 'wiprefix',
+                               'type' => 'text',
+                               'size' => 20,
+                               'default' => $this->prefix
+                       ]
+               ];
 
-               return Html::openElement( 'form', [ 'method' => 'get', 'action' => wfScript() ] ) . "\n" .
-                       Html::openElement( 'fieldset' ) . "\n" .
-                       Html::element( 'legend', null, $this->msg( 'withoutinterwiki-legend' )->text() ) . "\n" .
-                       Html::hidden( 'title', $t->getPrefixedText() ) . "\n" .
-                       Xml::inputLabel(
-                               $this->msg( 'allpagesprefix' )->text(),
-                               'prefix',
-                               'wiprefix',
-                               20,
-                               $prefix
-                       ) . "\n" .
-                       Xml::submitButton( $this->msg( 'withoutinterwiki-submit' )->text() ) . "\n" .
-                       Html::closeElement( 'fieldset' ) . "\n" .
-                       Html::closeElement( 'form' );
+               $htmlForm = HTMLForm::factory( 'inline', $formDescriptor, $this->getContext() );
+               $htmlForm->setWrapperLegendMsg( 'withoutinterwiki-legend' )
+                       ->setSubmitTextMsg( 'withoutinterwiki-submit' )
+                       ->setMethod( 'get' )
+                       ->prepareForm()
+                       ->displayForm( false );
        }
 
        function sortDescending() {