$changed = $this->opts->getChangedValues();
unset( $changed['offset'] ); // Reset offset if query type changes
+ // wfArrayToCgi(), called from LinkRenderer/Title, will not output null and false values
+ // to the URL, which would omit some options (T158504). Fix it by explicitly setting them
+ // to 0 or 1.
+ $changed = array_map( function ( $value ) {
+ return $value ? '1' : '0';
+ }, $changed );
+
$self = $this->getPageTitle();
$linkRenderer = $this->getLinkRenderer();
foreach ( $filters as $key => $msg ) {
$ut = Title::makeTitleSafe( NS_USER, $username );
$userText = $ut ? $ut->getText() : '';
- // Store query values in hidden fields so that form submission doesn't lose them
- $hidden = [];
- foreach ( $this->opts->getUnconsumedValues() as $key => $value ) {
- $hidden[] = Html::hidden( $key, $value );
- }
- $hidden = implode( "\n", $hidden );
-
- $form = [
+ $formDescriptor = [
'namespace' => [
'type' => 'namespaceselect',
'name' => 'namespace',
],
];
- $htmlForm = new HTMLForm( $form, $this->getContext() );
+ $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
- $htmlForm->setSubmitText( $this->msg( 'newpages-submit' )->text() );
- // The form should be visible on each request (inclusive requests with submitted forms), so
- // return always false here.
- $htmlForm->setSubmitCallback(
- function () {
- return false;
- }
- );
- $htmlForm->setMethod( 'get' );
- $htmlForm->setWrapperLegend( true );
- $htmlForm->setWrapperLegendMsg( 'newpages' );
- $htmlForm->addFooterText( Html::rawElement(
- 'div',
- null,
- $this->filterLinks()
- ) );
- $htmlForm->show();
+ // Store query values in hidden fields so that form submission doesn't lose them
+ foreach ( $this->opts->getUnconsumedValues() as $key => $value ) {
+ $htmlForm->addHiddenField( $key, $value );
+ }
+
+ $htmlForm
+ ->setMethod( 'get' )
+ ->setFormIdentifier( 'newpagesform' )
+ // The form should be visible on each request (inclusive requests with submitted forms), so
+ // return always false here.
+ ->setSubmitCallback(
+ function () {
+ return false;
+ }
+ )
+ ->setSubmitText( $this->msg( 'newpages-submit' )->text() )
+ ->setWrapperLegend( $this->msg( 'newpages' )->text() )
+ ->addFooterText( Html::rawElement(
+ 'div',
+ null,
+ $this->filterLinks()
+ ) )
+ ->show();
+ $out->addModuleStyles( 'mediawiki.special' );
}
/**