Standardize html form by using OOUI in Special:Categories
authorAmir Sarabadani <Ladsgroup@gmail.com>
Sun, 22 Jan 2017 03:44:53 +0000 (07:14 +0330)
committerAmir Sarabadani <Ladsgroup@gmail.com>
Sun, 22 Jan 2017 14:04:23 +0000 (17:34 +0330)
Bug: T117728
Change-Id: I4811771210384a32407b7378c7428361e46da33e

includes/specials/pagers/CategoryPager.php [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 345577d..eb36980
@@ -92,21 +92,28 @@ class CategoryPager extends AlphabeticPager {
        }
 
        public function getStartForm( $from ) {
-               return Xml::tags(
-                       'form',
-                       [ 'method' => 'get', 'action' => wfScript() ],
-                       Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
-                       Xml::fieldset(
-                               $this->msg( 'categories' )->text(),
-                               Xml::inputLabel(
-                                       $this->msg( 'categoriesfrom' )->text(),
-                                       'from', 'from', 20, $from, [ 'class' => 'mw-ui-input-inline' ] ) .
-                               ' ' .
-                               Html::submitButton(
-                                       $this->msg( 'categories-submit' )->text(),
-                                       [], [ 'mw-ui-progressive' ]
-                               )
-                       )
-               );
+               $formDescriptor = [
+                       'from' => [
+                               'type' => 'title',
+                               'namespace' => NS_CATEGORY,
+                               'relative' => true,
+                               'label-message' => 'categoriesfrom',
+                               'name' => 'from',
+                               'id' => 'from',
+                               'size' => 20,
+                               'default' => $from,
+                       ],
+               ];
+               $hiddenFields = [
+                       'title' => $this->getTitle()->getPrefixedText(),
+               ];
+
+               $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
+                       ->addHiddenFields( $hiddenFields )
+                       ->setSubmitTextMsg( 'categories-submit' )
+                       ->setWrapperLegendMsg( 'categories' )
+                       ->setMethod( 'get' );
+               return $htmlForm->prepareForm()->getHTML( false );
        }
+
 }