diff --git a/includes/Special/AbuseFilterSpecialPage.php b/includes/Special/AbuseFilterSpecialPage.php index ee3bb8107..6caa17ad3 100644 --- a/includes/Special/AbuseFilterSpecialPage.php +++ b/includes/Special/AbuseFilterSpecialPage.php @@ -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, diff --git a/includes/Special/SpecialAbuseLog.php b/includes/Special/SpecialAbuseLog.php index 85eabe159..3273ac32e 100644 --- a/includes/Special/SpecialAbuseLog.php +++ b/includes/Special/SpecialAbuseLog.php @@ -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 */