- $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() );
- $form->setSubmitCallback( array( $this, 'onSubmit' ) );
+ if ( $this->usesOOUI() ) {
+ $form = HTMLForm::factory( 'ooui', $this->fields, $this->getContext(), $this->getName() );
+ } else {
+ $form = new HTMLForm( $this->fields, $this->getContext(), $this->getName() );
+ }
+ $form->setSubmitCallback( [ $this, 'onSubmit' ] );