From: PiRSquared17 Date: Sun, 23 Nov 2014 22:38:42 +0000 (+0000) Subject: Add autocomplete for WhatLinksHere subpages X-Git-Tag: 1.31.0-rc.0~12719^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=078ae9dbf5aaafb3a58bf629960edf825e04b20e;p=lhc%2Fweb%2Fwiklou.git Add autocomplete for WhatLinksHere subpages Implements prefixSearchSubpages() Change-Id: I15895c0b5ae55419928d624c318a53c27cde2820 --- diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 11ec3637e2..7e7abe5b35 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -496,6 +496,24 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { ); } + /** + * 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 ) { + if ( $search === '' ) { + 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'; }