- private function makeForm() {
- $form = Html::openElement( 'fieldset' ) . "\n";
- $form .= Html::element(
- 'legend',
- array(),
- $this->msg( 'booksources-search-legend' )->text()
- ) . "\n";
- $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) . "\n";
- $form .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . "\n";
- $form .= '<p>' . Xml::inputLabel(
- $this->msg( 'booksources-isbn' )->text(),
- 'isbn',
- 'isbn',
- 20,
- $this->isbn,
- array( 'autofocus' => '', 'class' => 'mw-ui-input-inline' )
- );
-
- $form .= ' ' . Html::submitButton(
- $this->msg( 'booksources-search' )->text(),
- array(), array( 'mw-ui-progressive' )
- ) . "</p>\n";
-
- $form .= Html::closeElement( 'form' ) . "\n";
- $form .= Html::closeElement( 'fieldset' ) . "\n";
-
- return $form;
+ private function buildForm( $isbn ) {
+ $formDescriptor = [
+ 'isbn' => [
+ 'type' => 'text',
+ 'name' => 'isbn',
+ 'label-message' => 'booksources-isbn',
+ 'default' => $isbn,
+ 'autofocus' => true,
+ 'required' => true,
+ ],
+ ];
+
+ $context = new DerivativeContext( $this->getContext() );
+ $context->setTitle( $this->getPageTitle() );
+ HTMLForm::factory( 'ooui', $formDescriptor, $context )
+ ->setWrapperLegendMsg( 'booksources-search-legend' )
+ ->setSubmitTextMsg( 'booksources-search' )
+ ->setMethod( 'get' )
+ ->prepareForm()
+ ->displayForm( false );