From f31209dfb307ec2bac20107e788578b762f70e89 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Thu, 22 Nov 2012 23:57:02 +0200 Subject: [PATCH] (bug 42337) Simplify "my talk" link logic in personal tools Change I822a7390 introduced a somewhat complex way to display the "talk" link in parentheses after the username. It would only work in Vector, and it broke the display in RTL wikis, because it hacked into the personal links array. This change attempts to make it more robust, by keeping the array intact and adding the parentheses to the mytalk item as a special case in SkinTemplate::makeListItem(). This fixes the display in RTL wikis and allows the parentheses to be displayed in all skins. This commit also eliminates the global $wgVectorCombineUserTalk, which is not needed any more. Change-Id: I36ec3bec89a17cab3e4fc56ccf5038f7df93d213 --- includes/DefaultSettings.php | 7 ------- includes/SkinTemplate.php | 7 +++++++ skins/Vector.php | 16 +--------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 60c3ab8754..77a9de1e82 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2776,13 +2776,6 @@ $wgFooterIcons = array( */ $wgUseCombinedLoginLink = false; -/** - * Appearance of user page and talk page labels in personal tools. - * - true = combine links into a single label - * - false = keep links in separate labels - */ -$wgVectorCombineUserTalk = false; - /** * Search form look for Vector skin only. * - true = use an icon search button diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 173d37af6f..a24ece5c8a 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -1777,6 +1777,13 @@ abstract class BaseTemplate extends QuickTemplate { $attrs['class'] .= ' active'; $attrs['class'] = trim( $attrs['class'] ); } + + // A special case for the talk link in personal tools. + // See bug 41672 and 42337. + if ( $key === 'mytalk' ) { + $html = $this->getMsg( 'parentheses' )->rawParams( $html )->escaped(); + } + return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html ); } diff --git a/skins/Vector.php b/skins/Vector.php index 92eb3ad02f..8d685bdf6c 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -367,7 +367,7 @@ class VectorTemplate extends BaseTemplate { * @param $elements array */ protected function renderNavigation( $elements ) { - global $wgVectorUseSimpleSearch, $wgVectorCombineUserTalk; + global $wgVectorUseSimpleSearch; // If only one element was given, wrap it in an array, allowing more // flexible arguments @@ -452,20 +452,6 @@ class VectorTemplate extends BaseTemplate { html( 'userlangattributes' ) ?>> getPersonalTools(); - if ( $wgVectorCombineUserTalk && isset( $personalTools['userpage'] ) ) { -?> -
  • -makeListItem( 'userpage', $personalTools['userpage'], array( 'tag' => 'span' ) ); -?> getMsg( 'mytalk-parenthetical' )->text(); - $talkItem = $this->makeListItem( 'mytalk', $personalTools['mytalk'], array( 'tag' => 'span' ) ); - echo $this->getMsg( 'parentheses' )->rawParams( $talkItem )->escaped(); - unset( $personalTools['userpage'], $personalTools['mytalk'] ); -?> -
  • - $item ) { echo $this->makeListItem( $key, $item ); } -- 2.20.1