-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Wikia#5793 from Wikia/CON-2326-release255
Con 2326 release255
- Loading branch information
Showing
4 changed files
with
45 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
extensions/wikia/GlobalNavigation/GlobalNavigationHooks.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class GlobalNavigationHooks { | ||
|
||
//In case monobook skin is selected we need to set wgMWSuggestTemplate variable. | ||
//By default wgEnableMWSuggest is disabled when GlobalNav extension is enabled. | ||
//ResourceLoaderStartUpModule operates on different web request than main context. | ||
//That's why changing wgEnableMWSuggest to true in hook is not enough | ||
static public function onResourceLoaderGetConfigVarsWithContext(&$vars, $context) { | ||
global $wgUseAjax; | ||
$skin = $context->getSkin(); | ||
|
||
if ($skin == 'monobook' || $skin == 'uncyclopedia') { | ||
if (!empty($wgUseAjax)) { | ||
$vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
//In case of monobook, GlobalNavigation is not present and we want to show to users MW suggestions. | ||
static public function onOutputPageParserOutput( OutputPage &$out, ParserOutput $parseroutput ) { | ||
global $wgEnableMWSuggest; | ||
$skin = $out->getSkin()->getSkinName(); | ||
|
||
if ($skin == 'monobook' || $skin == 'uncyclopedia') { | ||
$wgEnableMWSuggest = true; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters