* wgMainPageTitle variable now available to JavaScript code to identify the main page link, so it doesn't have to be extracted from the link URLs.

Can be used to link to the main page, or check if we're currently on the main page, without having to hardcode the local name (which may be customized in the message)
This commit is contained in:
Brion Vibber 2009-08-04 19:17:31 +00:00
parent e3e38856ae
commit cf75bdf4ba
2 changed files with 4 additions and 0 deletions

View file

@ -185,6 +185,8 @@ this. Was used when mwEmbed was going to be an extension.
flags have tooltips.
* (bug 15209) New hook BeforeInitialize called after everything has been setup
but before Mediawiki::performRequestForTitle()
* wgMainPageTitle variable now available to JavaScript code to identify the main
page link, so it doesn't have to be extracted from the link URLs.
=== Bug fixes in 1.16 ===

View file

@ -379,6 +379,7 @@ class Skin extends Linker {
implode( "\t", $digitTransTable ),
);
$mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) );
$vars = array(
'skin' => $skinName,
'stylepath' => $wgStylePath,
@ -408,6 +409,7 @@ class Skin extends Linker {
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgSeparatorTransformTable' => $compactSeparatorTransTable,
'wgDigitTransformTable' => $compactDigitTransTable,
'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null,
);
if ( !( $wgContLang->hasVariants() ) ) {
unset( $vars['wgUserVariant'] );