mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CiteThisPage
synced 2024-11-15 03:33:55 +00:00
Allow auto suggestion for subpages of Special:CiteThisPage
The autocomplete search allows special pages to define the list of subpages to be excepted. Fill up the function to show auto suggestion for subpages of Special:CiteThisPage Change-Id: I2426f21358644d2e6212fb239b2a3ad56fb1398f
This commit is contained in:
parent
bde8955d6a
commit
52f3c0ac29
|
@ -61,6 +61,26 @@ class SpecialCiteThisPage extends SpecialPage {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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() {
|
protected function getGroupName() {
|
||||||
return 'pagetools';
|
return 'pagetools';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue