mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Merge "Register AbuseFilter menu as standard tabs"
This commit is contained in:
commit
6c34801068
|
@ -31,11 +31,31 @@ abstract class AbuseFilterSpecialPage extends SpecialPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add topbar navigation links
|
||||
*
|
||||
* @param string $pageType
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function addNavigationLinks( $pageType ) {
|
||||
public function getShortDescription( string $path = '' ): string {
|
||||
switch ( $path ) {
|
||||
case 'AbuseFilter':
|
||||
return $this->msg( 'abusefilter-topnav-home' )->text();
|
||||
case 'AbuseFilter/history':
|
||||
return $this->msg( 'abusefilter-topnav-recentchanges' )->text();
|
||||
case 'AbuseFilter/examine':
|
||||
return $this->msg( 'abusefilter-topnav-examine' )->text();
|
||||
case 'AbuseFilter/test':
|
||||
return $this->msg( 'abusefilter-topnav-test' )->text();
|
||||
case 'AbuseFilter/tools':
|
||||
return $this->msg( 'abusefilter-topnav-tools' )->text();
|
||||
default:
|
||||
return parent::getShortDescription( $path );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get topbar navigation links definitions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getNavigationLinksInternal(): array {
|
||||
$performer = $this->getAuthority();
|
||||
|
||||
$linkDefs = [
|
||||
|
@ -57,8 +77,33 @@ abstract class AbuseFilterSpecialPage extends SpecialPage {
|
|||
];
|
||||
}
|
||||
|
||||
$links = [];
|
||||
return $linkDefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of strings representing page titles that are discoverable to end users via UI.
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getAssociatedNavigationLinks(): array {
|
||||
$links = $this->getNavigationLinksInternal();
|
||||
return array_map( static function ( $name ) {
|
||||
return 'Special:' . $name;
|
||||
}, array_values( $links ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add topbar navigation links
|
||||
*
|
||||
* @param string $pageType
|
||||
*/
|
||||
protected function addNavigationLinks( $pageType ) {
|
||||
// If the current skin supports sub menus nothing to do here.
|
||||
if ( $this->getSkin()->supportsMenu( 'associated-pages' ) ) {
|
||||
return;
|
||||
}
|
||||
$linkDefs = $this->getNavigationLinksInternal();
|
||||
$links = [];
|
||||
foreach ( $linkDefs as $name => $page ) {
|
||||
// Give grep a chance to find the usages:
|
||||
// abusefilter-topnav-home, abusefilter-topnav-recentchanges, abusefilter-topnav-test,
|
||||
|
|
|
@ -232,6 +232,13 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getShortDescription( string $path = '' ): string {
|
||||
return $this->msg( 'abusefilter-topnav-log' )->text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads parameters from request
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue