From 040314c50439cb68cbe1eaa0dda5827bdc8fcb90 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 2 Dec 2015 11:17:00 +0000 Subject: [PATCH] Configure footer and sidebar placements Changes: * Rename $wgRelatedArticlesShowReadMore to $wgRelatedArticlesShowInFooter * Add $wgRelatedArticlesShowInSidebar, which is truthy by default, and short circuit the SkinBuildSidebar and SkinTemplateToolboxEnd hook handlers if it is falsy Bug: T119926 Change-Id: Idf04bf3221ba44d7b898160764fbd6ba83561abb --- extension.json | 4 ++-- includes/FooterHooks.php | 8 ++++---- includes/SidebarHooks.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extension.json b/extension.json index cd369a3a..bdaea2bb 100644 --- a/extension.json +++ b/extension.json @@ -97,8 +97,8 @@ } }, "config": { - "@RelatedArticlesShowReadMore": "If true, shows ReadMore while hiding related articles from the sidebar on desktop.", - "RelatedArticlesShowReadMore": false, + "RelatedArticlesShowInSidebar": true, + "RelatedArticlesShowInFooter": false, "RelatedArticlesUseCirrusSearch": false, "RelatedArticlesOnlyUseCirrusSearch": false, "RelatedArticlesLoggingSamplingRate": 0.01 diff --git a/includes/FooterHooks.php b/includes/FooterHooks.php index 167c4fe1..e0d76502 100644 --- a/includes/FooterHooks.php +++ b/includes/FooterHooks.php @@ -40,10 +40,10 @@ class FooterHooks { * to the output when: * *
    - *
  1. $wgRelatedArticlesShowReadMore is truthy
  2. + *
  3. $wgRelatedArticlesShowInFooter is truthy
  4. *
  5. On mobile, the output is being rendered with * SkinMinervaBeta
  6. - *
  7. On desktop, the beta feature has been enabled.
  8. + *
  9. On desktop, the beta feature has been enabled
  10. *
  11. The page is in mainspace
  12. *
* @@ -53,7 +53,7 @@ class FooterHooks { */ public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { $config = ConfigFactory::getDefaultInstance()->makeConfig( 'RelatedArticles' ); - $showReadMore = $config->get( 'RelatedArticlesShowReadMore' ); + $showReadMore = $config->get( 'RelatedArticlesShowInFooter' ); $title = $out->getContext()->getTitle(); @@ -170,7 +170,7 @@ class FooterHooks { */ public static function onGetBetaFeaturePreferences( User $user, array &$preferences ) { $config = ConfigFactory::getDefaultInstance()->makeConfig( 'RelatedArticles' ); - $showReadMore = $config->get( 'RelatedArticlesShowReadMore' ); + $showReadMore = $config->get( 'RelatedArticlesShowInFooter' ); if ( $showReadMore ) { $wgExtensionAssetsPath = $config->get( 'ExtensionAssetsPath' ); diff --git a/includes/SidebarHooks.php b/includes/SidebarHooks.php index fa208679..5bdd938c 100644 --- a/includes/SidebarHooks.php +++ b/includes/SidebarHooks.php @@ -157,7 +157,7 @@ class SidebarHooks { private static function isInSidebar( $relatedPages, User $user ) { $config = ConfigFactory::getDefaultInstance()->makeConfig( 'RelatedArticles' ); - if ( !$relatedPages || $config->get( 'RelatedArticlesShowReadMore' ) ) { + if ( !$relatedPages || !$config->get( 'RelatedArticlesShowInSidebar' ) ) { return false; }