Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions
Additionally, renamed couple options for better readability. Bug: T221012 Change-Id: Ia347a60d469fba8f35afa7c70aa806a46271dccd
This commit is contained in:
parent
02d5a878a1
commit
4efd72a879
|
@ -239,29 +239,29 @@ class MinervaHooks {
|
||||||
|
|
||||||
$isBeta = $mobileContext->isBetaGroupMember();
|
$isBeta = $mobileContext->isBetaGroupMember();
|
||||||
$skinOptions->setMultiple( [
|
$skinOptions->setMultiple( [
|
||||||
SkinOptions::OPTION_AMC => $userMode->isEnabled(),
|
SkinOptions::AMC_MODE => $userMode->isEnabled(),
|
||||||
SkinOptions::OPTIONS_TALK_AT_TOP => $featureManager->isFeatureAvailableForCurrentUser(
|
SkinOptions::TALK_AT_TOP => $featureManager->isFeatureAvailableForCurrentUser(
|
||||||
'MinervaTalkAtTop'
|
'MinervaTalkAtTop'
|
||||||
),
|
),
|
||||||
SkinOptions::OPTIONS_MOBILE_BETA
|
SkinOptions::BETA_MODE
|
||||||
=> $isBeta,
|
=> $isBeta,
|
||||||
SkinOptions::OPTION_CATEGORIES
|
SkinOptions::CATEGORIES
|
||||||
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaShowCategoriesButton' ),
|
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaShowCategoriesButton' ),
|
||||||
SkinOptions::OPTION_BACK_TO_TOP
|
SkinOptions::BACK_TO_TOP
|
||||||
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaEnableBackToTop' ),
|
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaEnableBackToTop' ),
|
||||||
SkinOptions::OPTION_PAGE_ISSUES
|
SkinOptions::PAGE_ISSUES
|
||||||
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaPageIssuesNewTreatment' ),
|
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaPageIssuesNewTreatment' ),
|
||||||
SkinOptions::OPTION_SHARE_BUTTON
|
SkinOptions::SHARE_BUTTON
|
||||||
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaShareButton' ),
|
=> $featureManager->isFeatureAvailableForCurrentUser( 'MinervaShareButton' ),
|
||||||
SkinOptions::OPTION_TOGGLING => true,
|
SkinOptions::TOGGLING => true,
|
||||||
SkinOptions::OPTION_MOBILE_OPTIONS => true,
|
SkinOptions::MOBILE_OPTIONS => true,
|
||||||
SkinOptions::OPTIONS_HISTORY_PAGE_ACTIONS => $featureManager->isFeatureAvailableForCurrentUser(
|
SkinOptions::HISTORY_IN_PAGE_ACTIONS => $featureManager->isFeatureAvailableForCurrentUser(
|
||||||
'MinervaHistoryInPageActions'
|
'MinervaHistoryInPageActions'
|
||||||
),
|
),
|
||||||
SkinOptions::OPTION_OVERFLOW_SUBMENU => $featureManager->isFeatureAvailableForCurrentUser(
|
SkinOptions::TOOLBAR_SUBMENU => $featureManager->isFeatureAvailableForCurrentUser(
|
||||||
self::FEATURE_OVERFLOW_PAGE_ACTIONS
|
self::FEATURE_OVERFLOW_PAGE_ACTIONS
|
||||||
),
|
),
|
||||||
SkinOptions::OPTION_TABS_ON_SPECIALS => false,
|
SkinOptions::TABS_ON_SPECIALS => false,
|
||||||
] );
|
] );
|
||||||
Hooks::run( 'SkinMinervaOptionsInit', [ $skin, $skinOptions ] );
|
Hooks::run( 'SkinMinervaOptionsInit', [ $skin, $skinOptions ] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ return [
|
||||||
$definitions = $services->getService( 'Minerva.Menu.Definitions' );
|
$definitions = $services->getService( 'Minerva.Menu.Definitions' );
|
||||||
|
|
||||||
$context = RequestContext::getMain();
|
$context = RequestContext::getMain();
|
||||||
$builder = $options->get( SkinOptions::OPTION_AMC ) ?
|
$builder = $options->get( SkinOptions::AMC_MODE ) ?
|
||||||
new AdvancedUserMenuBuilder(
|
new AdvancedUserMenuBuilder(
|
||||||
$context,
|
$context,
|
||||||
$context->getUser(),
|
$context->getUser(),
|
||||||
|
@ -60,9 +60,9 @@ return [
|
||||||
/** @var SkinOptions $options */
|
/** @var SkinOptions $options */
|
||||||
$options = $services->getService( 'Minerva.SkinOptions' );
|
$options = $services->getService( 'Minerva.SkinOptions' );
|
||||||
$definitions = $services->getService( 'Minerva.Menu.Definitions' );
|
$definitions = $services->getService( 'Minerva.Menu.Definitions' );
|
||||||
$showMobileOptions = $options->get( SkinOptions::OPTION_MOBILE_OPTIONS );
|
$showMobileOptions = $options->get( SkinOptions::MOBILE_OPTIONS );
|
||||||
$user = $context->getUser();
|
$user = $context->getUser();
|
||||||
$builder = $options->get( SkinOptions::OPTION_AMC ) ?
|
$builder = $options->get( SkinOptions::AMC_MODE ) ?
|
||||||
new MainMenu\AdvancedBuilder( $showMobileOptions, $user, $definitions ) :
|
new MainMenu\AdvancedBuilder( $showMobileOptions, $user, $definitions ) :
|
||||||
new MainMenu\DefaultBuilder( $showMobileOptions, $user, $definitions );
|
new MainMenu\DefaultBuilder( $showMobileOptions, $user, $definitions );
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ return [
|
||||||
$userPageHelper,
|
$userPageHelper,
|
||||||
$languagesHelper
|
$languagesHelper
|
||||||
);
|
);
|
||||||
if ( $skinOptions->get( SkinOptions::OPTION_OVERFLOW_SUBMENU ) ) {
|
if ( $skinOptions->get( SkinOptions::TOOLBAR_SUBMENU ) ) {
|
||||||
$overflowBuilder = $userPageHelper->isUserPage() ?
|
$overflowBuilder = $userPageHelper->isUserPage() ?
|
||||||
new PageActionsMenu\UserNamespaceOverflowBuilder(
|
new PageActionsMenu\UserNamespaceOverflowBuilder(
|
||||||
$title,
|
$title,
|
||||||
|
|
|
@ -23,44 +23,44 @@ namespace MediaWiki\Minerva;
|
||||||
* A wrapper for all available Skin options.
|
* A wrapper for all available Skin options.
|
||||||
*/
|
*/
|
||||||
final class SkinOptions {
|
final class SkinOptions {
|
||||||
/** Set of keys for available skin options. See $skinOptions. */
|
|
||||||
const OPTION_MOBILE_OPTIONS = 'mobileOptionsLink';
|
|
||||||
const OPTION_AMC = 'amc';
|
|
||||||
const OPTION_CATEGORIES = 'categories';
|
|
||||||
const OPTION_BACK_TO_TOP = 'backToTop';
|
|
||||||
const OPTION_PAGE_ISSUES = 'pageIssues';
|
|
||||||
const OPTION_SHARE_BUTTON = 'shareButton';
|
|
||||||
const OPTION_TOGGLING = 'toggling';
|
|
||||||
const OPTIONS_MOBILE_BETA = 'beta';
|
|
||||||
const OPTIONS_TALK_AT_TOP = 'talkAtTop';
|
|
||||||
const OPTIONS_HISTORY_PAGE_ACTIONS = 'historyInPageActions';
|
|
||||||
const OPTION_OVERFLOW_SUBMENU = 'overflowSubmenu';
|
|
||||||
const OPTION_TABS_ON_SPECIALS = 'tabsOnSpecials';
|
|
||||||
|
|
||||||
/** @var array skin specific options */
|
const MOBILE_OPTIONS = 'mobileOptionsLink';
|
||||||
|
const AMC_MODE = 'amc';
|
||||||
|
const CATEGORIES = 'categories';
|
||||||
|
const BACK_TO_TOP = 'backToTop';
|
||||||
|
const PAGE_ISSUES = 'pageIssues';
|
||||||
|
const SHARE_BUTTON = 'shareButton';
|
||||||
|
const TOGGLING = 'toggling';
|
||||||
|
const BETA_MODE = 'beta';
|
||||||
|
const TALK_AT_TOP = 'talkAtTop';
|
||||||
|
const HISTORY_IN_PAGE_ACTIONS = 'historyInPageActions';
|
||||||
|
const TOOLBAR_SUBMENU = 'overflowSubmenu';
|
||||||
|
const TABS_ON_SPECIALS = 'tabsOnSpecials';
|
||||||
|
|
||||||
|
/** @var array skin specific options, initialized with default values */
|
||||||
private $skinOptions = [
|
private $skinOptions = [
|
||||||
// Defaults to true for desktop mode.
|
// Defaults to true for desktop mode.
|
||||||
self::OPTION_AMC => true,
|
self::AMC_MODE => true,
|
||||||
self::OPTIONS_MOBILE_BETA => false,
|
self::BETA_MODE => false,
|
||||||
/**
|
/**
|
||||||
* Whether the main menu should include a link to
|
* Whether the main menu should include a link to
|
||||||
* Special:Preferences of Special:MobileOptions
|
* Special:Preferences of Special:MobileOptions
|
||||||
*/
|
*/
|
||||||
self::OPTION_MOBILE_OPTIONS => false,
|
self::MOBILE_OPTIONS => false,
|
||||||
/** Whether a categories button should appear at the bottom of the skin. */
|
/** Whether a categories button should appear at the bottom of the skin. */
|
||||||
self::OPTION_CATEGORIES => false,
|
self::CATEGORIES => false,
|
||||||
/** Whether a back to top button appears at the bottom of the view page */
|
/** Whether a back to top button appears at the bottom of the view page */
|
||||||
self::OPTION_BACK_TO_TOP => false,
|
self::BACK_TO_TOP => false,
|
||||||
/** Whether a share button should appear in icons section */
|
/** Whether a share button should appear in icons section */
|
||||||
self::OPTION_SHARE_BUTTON => false,
|
self::SHARE_BUTTON => false,
|
||||||
/** Whether sections can be collapsed (requires MobileFrontend and MobileFormatter) */
|
/** Whether sections can be collapsed (requires MobileFrontend and MobileFormatter) */
|
||||||
self::OPTION_TOGGLING => false,
|
self::TOGGLING => false,
|
||||||
self::OPTION_PAGE_ISSUES => false,
|
self::PAGE_ISSUES => false,
|
||||||
self::OPTIONS_TALK_AT_TOP => false,
|
self::TALK_AT_TOP => false,
|
||||||
self::OPTIONS_HISTORY_PAGE_ACTIONS => false,
|
self::HISTORY_IN_PAGE_ACTIONS => false,
|
||||||
self::OPTION_OVERFLOW_SUBMENU => false,
|
self::TOOLBAR_SUBMENU => false,
|
||||||
/** Whether to show tabs on special pages */
|
/** Whether to show tabs on special pages */
|
||||||
self::OPTION_TABS_ON_SPECIALS => false,
|
self::TABS_ON_SPECIALS => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ final class SkinOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether a skin option is truthy. Should be one of self:OPTION_* flags
|
* Return whether a skin option is truthy. Should be one of self:* constants
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -115,7 +115,7 @@ class ToolbarBuilder {
|
||||||
public function getGroup(): Group {
|
public function getGroup(): Group {
|
||||||
$group = new Group();
|
$group = new Group();
|
||||||
$permissions = $this->permissions;
|
$permissions = $this->permissions;
|
||||||
$userPageWithOveflowMode = $this->skinOptions->get( SkinOptions::OPTION_OVERFLOW_SUBMENU ) &&
|
$userPageWithOveflowMode = $this->skinOptions->get( SkinOptions::TOOLBAR_SUBMENU ) &&
|
||||||
$this->userPageHelper->isUserPage();
|
$this->userPageHelper->isUserPage();
|
||||||
|
|
||||||
if ( !$userPageWithOveflowMode && $permissions->isAllowed(
|
if ( !$userPageWithOveflowMode && $permissions->isAllowed(
|
||||||
|
|
|
@ -123,11 +123,11 @@ final class MinervaPagePermissions implements IMinervaPagePermissions {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $action === self::HISTORY && $this->title->exists() ) {
|
if ( $action === self::HISTORY && $this->title->exists() ) {
|
||||||
return $this->skinOptions->get( SkinOptions::OPTIONS_HISTORY_PAGE_ACTIONS );
|
return $this->skinOptions->get( SkinOptions::HISTORY_IN_PAGE_ACTIONS );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $action === SkinOptions::OPTION_OVERFLOW_SUBMENU ) {
|
if ( $action === SkinOptions::TOOLBAR_SUBMENU ) {
|
||||||
return $this->skinOptions->get( SkinOptions::OPTION_OVERFLOW_SUBMENU );
|
return $this->skinOptions->get( SkinOptions::TOOLBAR_SUBMENU );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !in_array( $action, $this->config->get( 'MinervaPageActions' ) ) ) {
|
if ( !in_array( $action, $this->config->get( 'MinervaPageActions' ) ) ) {
|
||||||
|
|
|
@ -274,9 +274,9 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
'secondaryactionshtml' => $this->getSecondaryActionsHtml(),
|
'secondaryactionshtml' => $this->getSecondaryActionsHtml(),
|
||||||
'dataAfterContent' => $this->get( 'dataAfterContent' ),
|
'dataAfterContent' => $this->get( 'dataAfterContent' ),
|
||||||
'footer' => $this->getFooterTemplateData( $data ),
|
'footer' => $this->getFooterTemplateData( $data ),
|
||||||
'isBeta' => $skinOptions->get( SkinOptions::OPTIONS_MOBILE_BETA ),
|
'isBeta' => $skinOptions->get( SkinOptions::BETA_MODE ),
|
||||||
'tabs' => $this->showTalkTabs( $hasPageActions, $skinOptions ) &&
|
'tabs' => $this->showTalkTabs( $hasPageActions, $skinOptions ) &&
|
||||||
$skinOptions->get( SkinOptions::OPTIONS_TALK_AT_TOP ) ? [
|
$skinOptions->get( SkinOptions::TALK_AT_TOP ) ? [
|
||||||
'items' => array_values( $data['content_navigation']['namespaces'] ),
|
'items' => array_values( $data['content_navigation']['namespaces'] ),
|
||||||
] : false,
|
] : false,
|
||||||
];
|
];
|
||||||
|
@ -306,7 +306,7 @@ class MinervaTemplate extends BaseTemplate {
|
||||||
private function showTalkTabs( $hasPageActions, SkinOptions $skinOptions ) {
|
private function showTalkTabs( $hasPageActions, SkinOptions $skinOptions ) {
|
||||||
$hasTalkTabs = $hasPageActions && !$this->isMainPageTalk;
|
$hasTalkTabs = $hasPageActions && !$this->isMainPageTalk;
|
||||||
if ( !$hasTalkTabs && $this->isSpecialPage &&
|
if ( !$hasTalkTabs && $this->isSpecialPage &&
|
||||||
$skinOptions->get( SkinOptions::OPTION_TABS_ON_SPECIALS ) ) {
|
$skinOptions->get( SkinOptions::TABS_ON_SPECIALS ) ) {
|
||||||
$hasTalkTabs = true;
|
$hasTalkTabs = true;
|
||||||
}
|
}
|
||||||
return $hasTalkTabs;
|
return $hasTalkTabs;
|
||||||
|
|
|
@ -195,7 +195,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
// If it's a talk page, add a link to the main namespace page
|
// If it's a talk page, add a link to the main namespace page
|
||||||
// In AMC we do not need to do this as there is an easy way back to the article page
|
// In AMC we do not need to do this as there is an easy way back to the article page
|
||||||
// via the talk/article tabs.
|
// via the talk/article tabs.
|
||||||
if ( $title->isTalkPage() && !$this->skinOptions->get( SkinOptions::OPTION_AMC ) ) {
|
if ( $title->isTalkPage() && !$this->skinOptions->get( SkinOptions::AMC_MODE ) ) {
|
||||||
// if it's a talk page for which we have a special message, use it
|
// if it's a talk page for which we have a special message, use it
|
||||||
switch ( $title->getNamespace() ) {
|
switch ( $title->getNamespace() ) {
|
||||||
case NS_USER_TALK:
|
case NS_USER_TALK:
|
||||||
|
@ -252,7 +252,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
*/
|
*/
|
||||||
public function getPageClasses( $title ) {
|
public function getPageClasses( $title ) {
|
||||||
$className = parent::getPageClasses( $title );
|
$className = parent::getPageClasses( $title );
|
||||||
$className .= ' ' . ( $this->skinOptions->get( SkinOptions::OPTIONS_MOBILE_BETA )
|
$className .= ' ' . ( $this->skinOptions->get( SkinOptions::BETA_MODE )
|
||||||
? 'beta' : 'stable' );
|
? 'beta' : 'stable' );
|
||||||
|
|
||||||
if ( $title->isMainPage() ) {
|
if ( $title->isMainPage() ) {
|
||||||
|
@ -265,7 +265,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
// The new treatment should only apply to the main namespace
|
// The new treatment should only apply to the main namespace
|
||||||
if (
|
if (
|
||||||
$title->getNamespace() === NS_MAIN &&
|
$title->getNamespace() === NS_MAIN &&
|
||||||
$this->skinOptions->get( SkinOptions::OPTION_PAGE_ISSUES )
|
$this->skinOptions->get( SkinOptions::PAGE_ISSUES )
|
||||||
) {
|
) {
|
||||||
$className .= ' issues-group-B';
|
$className .= ' issues-group-B';
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function hasCategoryLinks() {
|
private function hasCategoryLinks() {
|
||||||
if ( !$this->skinOptions->get( SkinOptions::OPTION_CATEGORIES ) ) {
|
if ( !$this->skinOptions->get( SkinOptions::CATEGORIES ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$categoryLinks = $this->getOutput()->getCategoryLinks();
|
$categoryLinks = $this->getOutput()->getCategoryLinks();
|
||||||
|
@ -581,7 +581,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
if ( $this->getUserPageHelper()->isUserPage() &&
|
if ( $this->getUserPageHelper()->isUserPage() &&
|
||||||
// when overflow menu is visible, we don't need to build secondary options
|
// when overflow menu is visible, we don't need to build secondary options
|
||||||
// as most of options are visible on Toolbar/Overflow menu
|
// as most of options are visible on Toolbar/Overflow menu
|
||||||
!$this->skinOptions->get( SkinOptions::OPTION_OVERFLOW_SUBMENU ) ) {
|
!$this->skinOptions->get( SkinOptions::TOOLBAR_SUBMENU ) ) {
|
||||||
$pageUser = $this->getUserPageHelper()->getPageUser();
|
$pageUser = $this->getUserPageHelper()->getPageUser();
|
||||||
$talkPage = $pageUser->getTalkPage();
|
$talkPage = $pageUser->getTalkPage();
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -731,7 +731,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
// in stable it will link to the wikitext talk page
|
// in stable it will link to the wikitext talk page
|
||||||
$title = $this->getTitle();
|
$title = $this->getTitle();
|
||||||
$subjectPage = $title->getSubjectPage();
|
$subjectPage = $title->getSubjectPage();
|
||||||
$talkAtBottom = !$this->skinOptions->get( SkinOptions::OPTIONS_TALK_AT_TOP ) ||
|
$talkAtBottom = !$this->skinOptions->get( SkinOptions::TALK_AT_TOP ) ||
|
||||||
$subjectPage->isMainPage();
|
$subjectPage->isMainPage();
|
||||||
$namespaces = $tpl->data['content_navigation']['namespaces'];
|
$namespaces = $tpl->data['content_navigation']['namespaces'];
|
||||||
if ( !$this->getUserPageHelper()->isUserPage()
|
if ( !$this->getUserPageHelper()->isUserPage()
|
||||||
|
@ -881,7 +881,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( $this->skinOptions->get( SkinOptions::OPTION_TOGGLING ) ) {
|
if ( $this->skinOptions->get( SkinOptions::TOGGLING ) ) {
|
||||||
// Extension can unload "toggling" modules via the hook
|
// Extension can unload "toggling" modules via the hook
|
||||||
$modules['toggling'] = [ 'skins.minerva.toggling' ];
|
$modules['toggling'] = [ 'skins.minerva.toggling' ];
|
||||||
}
|
}
|
||||||
|
@ -902,7 +902,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
*/
|
*/
|
||||||
public function addToBodyAttributes( $out, &$bodyAttrs ) {
|
public function addToBodyAttributes( $out, &$bodyAttrs ) {
|
||||||
$classes = $out->getProperty( 'bodyClassName' );
|
$classes = $out->getProperty( 'bodyClassName' );
|
||||||
if ( $this->skinOptions->get( SkinOptions::OPTION_AMC ) ) {
|
if ( $this->skinOptions->get( SkinOptions::AMC_MODE ) ) {
|
||||||
$classes .= ' minerva--amc-enabled';
|
$classes .= ' minerva--amc-enabled';
|
||||||
} else {
|
} else {
|
||||||
$classes .= ' minerva--amc-disabled';
|
$classes .= ' minerva--amc-disabled';
|
||||||
|
@ -939,11 +939,11 @@ class SkinMinerva extends SkinTemplate {
|
||||||
}
|
}
|
||||||
|
|
||||||
$keys = [
|
$keys = [
|
||||||
SkinOptions::OPTION_AMC,
|
SkinOptions::AMC_MODE,
|
||||||
SkinOptions::OPTIONS_TALK_AT_TOP,
|
SkinOptions::TALK_AT_TOP,
|
||||||
SkinOptions::OPTIONS_HISTORY_PAGE_ACTIONS,
|
SkinOptions::HISTORY_IN_PAGE_ACTIONS,
|
||||||
SkinOptions::OPTION_OVERFLOW_SUBMENU,
|
SkinOptions::TOOLBAR_SUBMENU,
|
||||||
SkinOptions::OPTION_TABS_ON_SPECIALS
|
SkinOptions::TABS_ON_SPECIALS
|
||||||
];
|
];
|
||||||
$includeAMCStyles = array_reduce( $keys, function ( $val, $key ) {
|
$includeAMCStyles = array_reduce( $keys, function ( $val, $key ) {
|
||||||
return $val || $this->skinOptions->get( $key );
|
return $val || $this->skinOptions->get( $key );
|
||||||
|
@ -952,7 +952,7 @@ class SkinMinerva extends SkinTemplate {
|
||||||
$styles[] = 'skins.minerva.amc.styles';
|
$styles[] = 'skins.minerva.amc.styles';
|
||||||
$styles[] = 'wikimedia.ui';
|
$styles[] = 'wikimedia.ui';
|
||||||
}
|
}
|
||||||
if ( $this->skinOptions->get( SkinOptions::OPTION_AMC ) ) {
|
if ( $this->skinOptions->get( SkinOptions::AMC_MODE ) ) {
|
||||||
// ToolbarBuilder is reusing the Contributions icon in toolbar @see T224735
|
// ToolbarBuilder is reusing the Contributions icon in toolbar @see T224735
|
||||||
$styles[] = 'skins.minerva.mainMenu.icons';
|
$styles[] = 'skins.minerva.mainMenu.icons';
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
|
||||||
$outputPage->expects( $this->never() )
|
$outputPage->expects( $this->never() )
|
||||||
->method( 'getCategoryLinks' );
|
->method( 'getCategoryLinks' );
|
||||||
|
|
||||||
$this->overrideSkinOptions( [ SkinOptions::OPTION_CATEGORIES => false ] );
|
$this->overrideSkinOptions( [ SkinOptions::CATEGORIES => false ] );
|
||||||
$context = new RequestContext();
|
$context = new RequestContext();
|
||||||
$context->setTitle( Title::newFromText( 'Test' ) );
|
$context->setTitle( Title::newFromText( 'Test' ) );
|
||||||
$context->setOutput( $outputPage );
|
$context->setOutput( $outputPage );
|
||||||
|
@ -87,7 +87,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
|
||||||
->method( 'getCategoryLinks' )
|
->method( 'getCategoryLinks' )
|
||||||
->will( $this->returnValue( $categoryLinks ) );
|
->will( $this->returnValue( $categoryLinks ) );
|
||||||
|
|
||||||
$this->overrideSkinOptions( [ SkinOptions::OPTION_CATEGORIES => true ] );
|
$this->overrideSkinOptions( [ SkinOptions::CATEGORIES => true ] );
|
||||||
|
|
||||||
$context = new RequestContext();
|
$context = new RequestContext();
|
||||||
$context->setTitle( Title::newFromText( 'Test' ) );
|
$context->setTitle( Title::newFromText( 'Test' ) );
|
||||||
|
@ -143,7 +143,7 @@ class SkinMinervaTest extends MediaWikiTestCase {
|
||||||
*/
|
*/
|
||||||
public function testGetContextSpecificModules( $backToTopValue, $moduleName, $expected ) {
|
public function testGetContextSpecificModules( $backToTopValue, $moduleName, $expected ) {
|
||||||
$this->overrideSkinOptions( [
|
$this->overrideSkinOptions( [
|
||||||
SkinOptions::OPTION_AMC => false,
|
SkinOptions::AMC_MODE => false,
|
||||||
'backToTop' => $backToTopValue,
|
'backToTop' => $backToTopValue,
|
||||||
] );
|
] );
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@ class SkinOptionsTest extends \MediaWikiUnitTestCase {
|
||||||
*/
|
*/
|
||||||
public function testSettersAndGetters() {
|
public function testSettersAndGetters() {
|
||||||
$options = new SkinOptions();
|
$options = new SkinOptions();
|
||||||
$defaultValue = $options->get( SkinOptions::OPTION_AMC );
|
$defaultValue = $options->get( SkinOptions::AMC_MODE );
|
||||||
$options->setMultiple( [ SkinOptions::OPTION_AMC => !$defaultValue ] );
|
$options->setMultiple( [ SkinOptions::AMC_MODE => !$defaultValue ] );
|
||||||
|
|
||||||
$allOptions = $options->getAll();
|
$allOptions = $options->getAll();
|
||||||
|
|
||||||
$this->assertEquals( !$defaultValue, $options->get( SkinOptions::OPTION_AMC ) );
|
$this->assertEquals( !$defaultValue, $options->get( SkinOptions::AMC_MODE ) );
|
||||||
$this->assertArrayHasKey( SkinOptions::OPTION_AMC, $allOptions );
|
$this->assertArrayHasKey( SkinOptions::AMC_MODE, $allOptions );
|
||||||
$this->assertEquals( !$defaultValue, $allOptions[ SkinOptions::OPTION_AMC ] );
|
$this->assertEquals( !$defaultValue, $allOptions[ SkinOptions::AMC_MODE ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,15 +34,15 @@ class SkinOptionsTest extends \MediaWikiUnitTestCase {
|
||||||
*/
|
*/
|
||||||
public function testHasSkinOptions() {
|
public function testHasSkinOptions() {
|
||||||
$options = new SkinOptions();
|
$options = new SkinOptions();
|
||||||
// set OPTION_AMC to true just in case someone decides to set everything to false
|
// set AMC_MODE to true just in case someone decides to set everything to false
|
||||||
// sometime in the future.
|
// sometime in the future.
|
||||||
$options->setMultiple( [ SkinOptions::OPTION_AMC => true ] );
|
$options->setMultiple( [ SkinOptions::AMC_MODE => true ] );
|
||||||
$this->assertTrue( $options->hasSkinOptions() );
|
$this->assertTrue( $options->hasSkinOptions() );
|
||||||
$options->setMultiple( [ SkinOptions::OPTION_BACK_TO_TOP => true ] );
|
$options->setMultiple( [ SkinOptions::BACK_TO_TOP => true ] );
|
||||||
$this->assertTrue( $options->hasSkinOptions() );
|
$this->assertTrue( $options->hasSkinOptions() );
|
||||||
$options->setMultiple( [
|
$options->setMultiple( [
|
||||||
SkinOptions::OPTION_AMC => false,
|
SkinOptions::AMC_MODE => false,
|
||||||
SkinOptions::OPTION_BACK_TO_TOP => false
|
SkinOptions::BACK_TO_TOP => false
|
||||||
] );
|
] );
|
||||||
$this->assertFalse( $options->hasSkinOptions() );
|
$this->assertFalse( $options->hasSkinOptions() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue