mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-23 10:19:05 +00:00
Enable special page tabs
For now this should be a NOOP as the existing "special" page tab is removed, put it paves the way for using tabs on special pages. Bug: T286466 Change-Id: Ic0b52b298d598c20987b172c81c732a31e409402
This commit is contained in:
parent
86caa17713
commit
8c57c9c12d
|
@ -283,7 +283,7 @@ class Hooks {
|
|||
true : $featureManager->isFeatureAvailableForCurrentUser(
|
||||
self::FEATURE_OVERFLOW_PAGE_ACTIONS
|
||||
),
|
||||
SkinOptions::TABS_ON_SPECIALS => false,
|
||||
SkinOptions::TABS_ON_SPECIALS => true,
|
||||
] );
|
||||
MWHooks::run( 'SkinMinervaOptionsInit', [ $skin, $skinOptions ] );
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ final class SkinOptions {
|
|||
/** no extension requirements */
|
||||
self::TOOLBAR_SUBMENU => true,
|
||||
/** Whether to show tabs on special pages */
|
||||
self::TABS_ON_SPECIALS => false,
|
||||
self::TABS_ON_SPECIALS => true,
|
||||
/** whether to show a personal menu */
|
||||
self::PERSONAL_MENU => true,
|
||||
/** whether to show a main menu with additional items */
|
||||
|
|
|
@ -140,11 +140,16 @@ class SkinMinerva extends SkinMustache {
|
|||
// There are some SkinTemplate modifications that occur after the execution of this hook
|
||||
// to add rel attributes and ID attributes.
|
||||
// The only one Minerva needs is this one so we manually add it.
|
||||
$isSpecialPage = $skin->getTitle()->isSpecialPage();
|
||||
foreach ( array_keys( $contentNavigationUrls['namespaces'] ) as $id ) {
|
||||
if ( in_array( $id, [ 'user_talk', 'talk' ] ) ) {
|
||||
$contentNavigationUrls['namespaces'][ $id ]['rel'] = 'discussion';
|
||||
}
|
||||
}
|
||||
// Do not output the "Special page" tab.
|
||||
if ( $isSpecialPage ) {
|
||||
unset( $contentNavigationUrls['namespaces']['special'] );
|
||||
}
|
||||
$this->contentNavigationUrls = $contentNavigationUrls;
|
||||
}
|
||||
|
||||
|
@ -216,7 +221,8 @@ class SkinMinerva extends SkinMustache {
|
|||
->getSubjectPage( $title );
|
||||
$isMainPageTalk = Title::newFromLinkTarget( $subjectPage )->isMainPage();
|
||||
return (
|
||||
$this->hasPageActions() && !$isMainPageTalk
|
||||
$this->hasPageActions() && !$isMainPageTalk &&
|
||||
$skinOptions->get( SkinOptions::TALK_AT_TOP )
|
||||
) || (
|
||||
$isSpecialPage &&
|
||||
$skinOptions->get( SkinOptions::TABS_ON_SPECIALS )
|
||||
|
@ -228,9 +234,8 @@ class SkinMinerva extends SkinMustache {
|
|||
* @return array
|
||||
*/
|
||||
private function getTabsData( array $contentNavigationUrls ) {
|
||||
$skinOptions = $this->getSkinOptions();
|
||||
$hasTalkTabs = $skinOptions->get( SkinOptions::TALK_AT_TOP ) && $this->hasPageTabs();
|
||||
if ( !$hasTalkTabs ) {
|
||||
$hasPageTabs = $this->hasPageTabs();
|
||||
if ( !$hasPageTabs ) {
|
||||
return [];
|
||||
}
|
||||
return $contentNavigationUrls ? [
|
||||
|
|
|
@ -42,6 +42,7 @@ class SkinOptionsTest extends MediaWikiUnitTestCase {
|
|||
SkinOptions::TOOLBAR_SUBMENU => false,
|
||||
SkinOptions::MAIN_MENU_EXPANDED => false,
|
||||
SkinOptions::PERSONAL_MENU => false,
|
||||
SkinOptions::TABS_ON_SPECIALS => false,
|
||||
] );
|
||||
$this->assertFalse( $options->hasSkinOptions() );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue