Merge "jquery.makeCollapsible: Support for .mw-collapsible-toggle inside <li>"
[lhc/web/wiklou.git] / includes / skins / SkinTemplate.php
index 278af67..b4be461 100644 (file)
@@ -17,6 +17,7 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * Base class for template-based skins.
@@ -477,6 +478,9 @@ class SkinTemplate extends Skin {
                $tpl->set( 'sidebar', $this->buildSidebar() );
                $tpl->set( 'nav_urls', $this->buildNavUrls() );
 
+               // Do this last in case hooks above add bottom scripts
+               $tpl->set( 'bottomscripts', $this->bottomScripts() );
+
                // Set the head scripts near the end, in case the above actions resulted in added scripts
                $tpl->set( 'headelement', $out->headElement( $this ) );
 
@@ -507,9 +511,6 @@ class SkinTemplate extends Skin {
                // See Skin::afterContentHook() for further documentation.
                $tpl->set( 'dataAfterContent', $this->afterContentHook() );
 
-               // Do this last in case hooks above add bottom scripts
-               $tpl->set( 'bottomscripts', $this->bottomScripts() );
-
                return $tpl;
        }
 
@@ -665,27 +666,21 @@ class SkinTemplate extends Skin {
                        $loginlink = $this->getUser()->isAllowed( 'createaccount' ) && $useCombinedLoginLink
                                ? 'nav-login-createaccount'
                                : 'pt-login';
-                       $is_signup = $request->getText( 'type' ) == 'signup';
 
                        $login_url = [
                                'text' => $this->msg( $loginlink )->text(),
                                'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                'active' => $title->isSpecial( 'Userlogin' )
-                                       && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
+                                       || $title->isSpecial( 'CreateAccount' ) && $useCombinedLoginLink,
                        ];
                        $createaccount_url = [
                                'text' => $this->msg( 'pt-createaccount' )->text(),
-                               'href' => self::makeSpecialUrl( 'Userlogin', "$returnto&type=signup" ),
-                               'active' => $title->isSpecial( 'Userlogin' ) && $is_signup,
+                               'href' => self::makeSpecialUrl( 'CreateAccount', $returnto ),
+                               'active' => $title->isSpecial( 'CreateAccount' ),
                        ];
 
                        // No need to show Talk and Contributions to anons if they can't contribute!
                        if ( User::groupHasPermission( '*', 'edit' ) ) {
-                               // Show the text "Not logged in"
-                               $personal_urls['anonuserpage'] = [
-                                       'text' => $this->msg( 'notloggedin' )->text()
-                               ];
-
                                // Because of caching, we can't link directly to the IP talk and
                                // contributions pages. Instead we use the special page shortcuts
                                // (which work correctly regardless of caching). This means we can't
@@ -740,6 +735,8 @@ class SkinTemplate extends Skin {
                        }
                }
 
+               $linkClass = MediaWikiServices::getInstance()->getLinkRenderer()->getLinkClasses( $title );
+
                // wfMessageFallback will nicely accept $message as an array of fallbacks
                // or just a single key
                $msg = wfMessageFallback( $message )->setContext( $this->getContext() );
@@ -762,11 +759,16 @@ class SkinTemplate extends Skin {
                        return $result;
                }
 
-               return [
+               $result = [
                        'class' => implode( ' ', $classes ),
                        'text' => $text,
                        'href' => $title->getLocalURL( $query ),
                        'primary' => true ];
+               if ( $linkClass !== '' ) {
+                       $result['link-class'] = $linkClass;
+               }
+
+               return $result;
        }
 
        function makeTalkUrlDetails( $name, $urlaction = '' ) {