- function getForm( $options ) {
- $options['title'] = $this->getPageTitle()->getPrefixedText();
- if ( !isset( $options['target'] ) ) {
- $options['target'] = '';
- } else {
- $options['target'] = str_replace( '_', ' ', $options['target'] );
- }
-
- if ( !isset( $options['namespace'] ) ) {
- $options['namespace'] = '';
- }
-
- if ( !isset( $options['contribs'] ) ) {
- $options['contribs'] = 'user';
- }
-
- if ( $options['contribs'] == 'newbie' ) {
- $options['target'] = '';
- }
-
- $f = Xml::openElement( 'form', [ 'method' => 'get', 'action' => wfScript() ] );
-
- foreach ( $options as $name => $value ) {
- if ( in_array( $name, [ 'namespace', 'target', 'contribs' ] ) ) {
- continue;
- }
- $f .= "\t" . Html::hidden( $name, $value ) . "\n";
- }
+ function getForm() {
+ $opts = $this->mOpts;
+
+ $formDescriptor = [
+ 'target' => [
+ 'type' => 'user',
+ 'name' => 'target',
+ 'label-message' => 'sp-contributions-username',
+ 'default' => $opts->getValue( 'target' ),
+ 'ipallowed' => true,
+ ],