jenkins-bot has submitted this change and it was merged.

Change subject: Build content navigation menu
......................................................................


Build content navigation menu

Remove need for our variant code \o/ for a big red diff!

Change-Id: I1b72dfdfa0fccd360b41e4bba713f93f9db1b2eb
---
M includes/skins/MinervaTemplate.php
M includes/skins/SkinMobile.php
M includes/skins/SkinMobileBase.php
3 files changed, 3 insertions(+), 51 deletions(-)

Approvals:
  MaxSem: Verified; Looks good to me, approved
  JGonera: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 92df280..93e8199 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -1,10 +1,6 @@
 <?php
 class MinervaTemplate extends BaseTemplate {
        private function prepareCommonData() {
-               // set defaults
-               $this->set( 'content_navigation', array(
-                       'variants' => array(),
-               ) );
                $this->set( 'language_urls', array() );
        }
 
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index 70e459a..75e2dcc 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -48,9 +48,6 @@
                $this->prepareTemplatePageContent( $tpl );
                $this->prepareTemplateLinks( $tpl );
                $tpl->set( 'language_urls', $this->getLanguages() );
-               $tpl->set( 'content_navigation', array(
-                       'variants' => $this->getLanguageVariants(),
-               ) );
 
                $tpl->set( 'isMainPage', $title->isMainPage() );
 
@@ -345,50 +342,6 @@
                }
                wfProfileOut( __METHOD__ );
                return $languageUrls;
-       }
-
-       /*
-               FIXME: This should be a function of SkinTemplate in core - 
currently this code
-               is buried inside the protected buildContentNavigationUrls 
function and thus
-               cannot be overriden
-       */
-       public function getLanguageVariants() {
-               global $wgDisableLangConversion;
-
-               wfProfileIn( __METHOD__ );
-               $languageVariantUrls = array();
-               $title = $this->getRelevantTitle();
-               $user = $this->getUser();
-               $userCanRead = $title->quickUserCan( 'read', $user );
-
-               if ( $userCanRead && !$wgDisableLangConversion ) {
-                       $pageLang = $title->getPageLanguage();
-                       // Gets list of language variants
-                       $variants = $pageLang->getVariants();
-                       // Checks that language conversion is enabled and 
variants exist
-                       // And if it is not in the special namespace
-                       if ( count( $variants ) > 1 ) {
-                               // Loops over each variant
-                               foreach ( $variants as $code ) {
-                                       // Gets variant name from language code
-                                       $varname = $pageLang->getVariantname( 
$code );
-                                       // Checks if the variant is marked as 
disabled
-                                       if ( $varname == 'disable' ) {
-                                               // Skips this variant
-                                               continue;
-                                       }
-                                       // Appends variant link
-                                       $languageVariantUrls[] = (array(
-                                               'text' => $varname,
-                                               'href' => $title->getLocalURL( 
array( 'variant' => $code ) ),
-                                               'lang' => $code
-                                       ));
-                               }
-                       }
-               }
-
-               wfProfileOut( __METHOD__ );
-               return $languageVariantUrls;
        }
 
        /**
diff --git a/includes/skins/SkinMobileBase.php 
b/includes/skins/SkinMobileBase.php
index 32852dc..21451cb 100644
--- a/includes/skins/SkinMobileBase.php
+++ b/includes/skins/SkinMobileBase.php
@@ -152,6 +152,9 @@
                $tpl->set( 'watchlistUrl', SpecialPage::getTitleFor( 
'Watchlist' )->getLocalUrl() );
                $tpl->set( 'searchField', $this->getRequest()->getText( 
'search', '' ) );
                $tpl->set( 'loggedin', $this->getUser()->isLoggedIn() );
+               $this->loggedin = $this->getUser()->isLoggedIn();
+               $content_navigation = $this->buildContentNavigationUrls();
+               $tpl->setRef( 'content_navigation', $content_navigation );
 
                wfProfileOut( __METHOD__ );
                return $tpl;

-- 
To view, visit https://gerrit.wikimedia.org/r/59985
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b72dfdfa0fccd360b41e4bba713f93f9db1b2eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to