From 870fa275dead3aaa1ab3bd71b5461f2c22fc17ba Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Sun, 22 Jan 2017 07:14:53 +0330 Subject: [PATCH] Standardize html form by using OOUI in Special:Categories Bug: T117728 Change-Id: I4811771210384a32407b7378c7428361e46da33e --- includes/specials/pagers/CategoryPager.php | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) mode change 100644 => 100755 includes/specials/pagers/CategoryPager.php diff --git a/includes/specials/pagers/CategoryPager.php b/includes/specials/pagers/CategoryPager.php old mode 100644 new mode 100755 index 345577d6ea..eb369802de --- a/includes/specials/pagers/CategoryPager.php +++ b/includes/specials/pagers/CategoryPager.php @@ -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 ); } + } -- 2.20.1