From d08f7a66660034ddc1a06ac6988eb05899d359e1 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 4 Jul 2015 00:40:15 -0700 Subject: [PATCH] Convert Special:RandomInCategory to use OOUI display format And set up autocompletion and validation for the Category input. Change-Id: I4c0b11e2ae0cfa906bbde77fc89901cf88a9a5bd --- includes/specials/SpecialRandomInCategory.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialRandomInCategory.php b/includes/specials/SpecialRandomInCategory.php index e21eaebbfe..7cf6b0a1b8 100644 --- a/includes/specials/SpecialRandomInCategory.php +++ b/includes/specials/SpecialRandomInCategory.php @@ -70,15 +70,15 @@ class SpecialRandomInCategory extends FormSpecialPage { protected function getFormFields() { $this->addHelpLink( 'Help:RandomInCategory' ); - $form = array( + return array( 'category' => array( - 'type' => 'text', + 'type' => 'title', + 'namespace' => NS_CATEGORY, + 'relative' => true, 'label-message' => 'randomincategory-category', 'required' => true, ) ); - - return $form; } public function requiresWrite() { @@ -89,6 +89,10 @@ class SpecialRandomInCategory extends FormSpecialPage { return false; } + protected function getDisplayFormat() { + return 'ooui'; + } + protected function alterForm( HTMLForm $form ) { $form->setSubmitTextMsg( 'randomincategory-submit' ); } -- 2.20.1