CologneBlue rewrite: fix variantLinks()
authorMatmaRex <matma.rex@gmail.com>
Sat, 29 Sep 2012 19:18:56 +0000 (21:18 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 4 Oct 2012 19:43:08 +0000 (19:43 +0000)
They used to use some weird ifs to determine whether to display this list,
and broken implementation caused an additional separator to appear at the
beginning.

Change-Id: I71eb97e09af9ac1bcf88da2aaeba97322e8be252

skins/CologneBlue.php

index 12bd85a..a22bab6 100644 (file)
@@ -62,33 +62,19 @@ class CologneBlueTemplate extends BaseTemplate {
        /**
         * Language/charset variant links for classic-style skins
         * @return string
+        *
+        * @fixed
         */
        function variantLinks() {
-               $s = '';
-
-               /* show links to different language variants */
-               global $wgDisableLangConversion;
-
-               $title = $this->getSkin()->getTitle();
-               $lang = $title->getPageLanguage();
-               $variants = $lang->getVariants();
+               $s = array();
 
-               if ( !$wgDisableLangConversion && sizeof( $variants ) > 1
-                       && !$title->isSpecialPage() ) {
-                       foreach ( $variants as $code ) {
-                               $varname = $lang->getVariantname( $code );
+               $variants = $this->data['content_navigation']['variants'];
 
-                               if ( $varname == 'disable' ) {
-                                       continue;
-                               }
-                               $s = $this->getSkin()->getLanguage()->pipeList( array(
-                                       $s,
-                                       '<a href="' . htmlspecialchars( $title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" hreflang="' . $code .  '">' . htmlspecialchars( $varname ) . '</a>'
-                               ) );
-                       }
+               foreach ( $variants as $key => $link ) {
+                       $s[] = $this->makeListItem( $key, $link, array( 'tag' => 'span' ) );
                }
 
-               return $s;
+               return $this->getSkin()->getLanguage()->pipeList( $s );
        }
        
        function otherLanguages() {