From: Sethakill Date: Fri, 6 May 2016 19:06:57 +0000 (+0200) Subject: Convert Special:MIMESearch to use OOUI. X-Git-Tag: 1.31.0-rc.0~7055^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=fc3c3784eb8171c4327f09b89c0e78b8455aeea5 Convert Special:MIMESearch to use OOUI. Bug: T117744 Change-Id: I6c8b0f3be92bc455fe62846508d0b21c778b993d --- diff --git a/includes/specials/SpecialMIMEsearch.php b/includes/specials/SpecialMIMEsearch.php index defca7de3d..e3be225fc0 100644 --- a/includes/specials/SpecialMIMEsearch.php +++ b/includes/specials/SpecialMIMEsearch.php @@ -106,21 +106,26 @@ class MIMEsearchPage extends QueryPage { } /** - * Return HTML to put just before the results. + * Generate and output the form */ function getPageHeader() { - return Xml::openElement( - 'form', - [ 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() ] - ) . - Xml::openElement( 'fieldset' ) . - Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . - Xml::element( 'legend', null, $this->msg( 'mimesearch' )->text() ) . - Xml::inputLabel( $this->msg( 'mimetype' )->text(), 'mime', 'mime', 20, $this->mime ) . - ' ' . - Xml::submitButton( $this->msg( 'ilsubmit' )->text() ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ); + $formDescriptor = [ + 'mime' => [ + 'type' => 'text', + 'name' => 'mime', + 'label-message' => 'mimetype', + 'required' => true, + 'default' => $this->mime, + ], + ]; + + $form = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ) + ->setWrapperLegendMsg( 'mimesearch' ) + ->setSubmitTextMsg( 'ilsubmit' ) + ->setAction( $this->getPageTitle()->getLocalURL() ) + ->setMethod( 'get' ) + ->prepareForm() + ->displayForm( false ); } public function execute( $par ) { @@ -133,7 +138,7 @@ class MIMEsearchPage extends QueryPage { ) { $this->setHeaders(); $this->outputHeader(); - $this->getOutput()->addHTML( $this->getPageHeader() ); + $this->getPageHeader(); return; }