* @param string $par Becomes "FOO" when called like Special:Prefixindex/FOO (default null)
*/
function execute( $par ) {
- global $wgContLang;
-
$this->setHeaders();
$this->outputHeader();
$this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects );
$this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix );
- $namespaces = $wgContLang->getNamespaces();
+ $namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
$out->setPageTitle(
( $namespace > 0 && array_key_exists( $namespace, $namespaces ) )
? $this->msg( 'prefixindex-namespace', str_replace( '_', ' ', $namespaces[$namespace] ) )
* @return string
*/
protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
- $fields = [
+ $formDescriptor = [
'prefix' => [
'label-message' => 'allpagesprefix',
+ 'name' => 'prefix',
+ 'id' => 'nsfrom',
'type' => 'text',
'size' => '30',
+ 'default' => str_replace( '_', ' ', $from ),
],
'namespace' => [
'type' => 'namespaceselect',
'id' => 'namespace',
'label-message' => 'namespace',
'all' => null,
- 'value' => $namespace,
+ 'default' => $namespace,
],
'hidedirects' => [
'class' => 'HTMLCheckField',
+ 'name' => 'hideredirects',
'label-message' => 'allpages-hide-redirects',
],
'stripprefix' => [
'class' => 'HTMLCheckField',
+ 'name' => 'stripprefix',
'label-message' => 'prefixindex-strip',
],
];
- $form = new HTMLForm( $fields, $this->getContext() );
- $form
+ $context = new DerivativeContext( $this->getContext() );
+ $context->setTitle( $this->getPageTitle() ); // Remove subpage
+ $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $context );
+ $htmlForm
->setMethod( 'get' )
- ->setWrapperLegendMsg( 'allpages' )
- ->setSubmitTextMsg( 'prefixindex-submit' )
- ->prepareForm()
- ->displayForm( false );
+ ->setWrapperLegendMsg( 'prefixindex' )
+ ->setSubmitTextMsg( 'prefixindex-submit' );
+
+ return $htmlForm->prepareForm()->getHTML( false );
}
/**
- * @param int $namespace Default NS_MAIN
+ * @param int $namespace
* @param string $prefix
- * @param string $from List all pages from this name (default false)
+ * @param string|null $from List all pages from this name (default false)
*/
- protected function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) {
- global $wgContLang;
-
+ protected function showPrefixChunk( $namespace, $prefix, $from = null ) {
if ( $from === null ) {
$from = $prefix;
}
$fromList = $this->getNamespaceKeyAndText( $namespace, $from );
$prefixList = $this->getNamespaceKeyAndText( $namespace, $prefix );
- $namespaces = $wgContLang->getNamespaces();
+ $namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
$res = null;
$n = 0;
$nextRow = null;