Merge "Make Special:MediaStatistics show a total count of file sizes"
[lhc/web/wiklou.git] / includes / specials / SpecialPageLanguage.php
index 177c19b..9323551 100644 (file)
@@ -48,9 +48,11 @@ class SpecialPageLanguage extends FormSpecialPage {
 
                $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
@@ -198,6 +200,26 @@ class SpecialPageLanguage extends FormSpecialPage {
                return $out1 . $out2;
        }
 
+       /**
+        * Return an array of subpages beginning with $search that this special page will accept.
+        *
+        * @param string $search Prefix to search for
+        * @param int $limit Maximum number of results to return (usually 10)
+        * @param int $offset Number of results to skip (usually 0)
+        * @return string[] Matching subpages
+        */
+       public function prefixSearchSubpages( $search, $limit, $offset ) {
+               $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
+               $prefixSearcher = new StringPrefixSearch;
+               $result = $prefixSearcher->search( $search, $limit, array(), $offset );
+               return $result;
+       }
+
        protected function getGroupName() {
                return 'pagetools';
        }