$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 );
-
$formDescriptor = [
'namespace' => [
'type' => 'namespaceselect',
];
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
+
+ // 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' )
'div',
null,
$this->filterLinks()
- ) . $hidden )
+ ) )
->show();
$out->addModuleStyles( 'mediawiki.special' );
}