$page = array();
$page['pagename'] = array(
- 'type' => 'text',
+ 'type' => 'title',
'label-message' => 'pagelang-name',
'default' => $defaultName,
+ 'autofocus' => $defaultName === null,
+ 'exists' => true,
);
// Options for whether to use the default language or select language
public function alterForm( HTMLForm $form ) {
Hooks::run( 'LanguageSelector', array( $this->getOutput(), 'mw-languageselector' ) );
+ $form->setSubmitTextMsg( 'pagelang-submit' );
}
/**
* @return string[] Matching subpages
*/
public function prefixSearchSubpages( $search, $limit, $offset ) {
- if ( $search === '' ) {
+ $title = Title::newFromText( $search );
+ if ( !$title || !$title->canExist() ) {
+ // No prefix suggestion in special and media namespace
return array();
}
// Autocomplete subpage the same as a normal search