$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 ) {
}
$hidden = implode( "\n", $hidden );
- $form = [
+ $formDescriptor = [
'namespace' => [
'type' => 'namespaceselect',
'name' => 'namespace',
],
];
- $htmlForm = new HTMLForm( $form, $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();
+ $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
+ $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' );
}
/**
// Let extensions add data
Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] );
- $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] );
+ $attribs = array_filter( $attribs,
+ [ Sanitizer::class, 'isReservedDataAttribute' ],
+ ARRAY_FILTER_USE_KEY
+ );
if ( count( $classes ) ) {
$attribs['class'] = implode( ' ', $classes );