Reputation: 13
In recent MediaWiki it does not seem possible to enable wikitext in the Sidebar, at least in Vector Skin. Wikitext allows more advanced formatting and insertion of images.
The only solution I have found is to install the CustomNavBlocks extension ( http://www.mediawiki.org/wiki/Extension:CustomNavBlocks ) but in MonoBook skin this forces images inside each box inside the Sidebar.
Is there a better way to enable wikitext globally for all skins?
Upvotes: 0
Views: 345
Reputation: 8520
The Sidebar is entirely the responsibility of the skin, so there is really no guaranteed way of modifying its behaviour across all skins.
However, most skins (and all built in ones) call the SkinBuildSidebar
hook at the end of rendering the sidebar, so one way to build an extensions for modifying the sidebar would be to add some parser there, that handles some extra markup that you invent for that very purpose.
Upvotes: 1
Reputation: 5333
$wgHooks["SkinBuildSidebar"][] = "fnSidebarMultiLevel";
function fnSidebarMultiLevel(Skin $skin, &$bar) {
global $wgOut;
$title = Title::makeTitle(NS_MEDIAWIKI, "Sidebar-Custom");
if ( !$title->exists() )
return true;
$text = WikiPage::factory($title)->getContent()->mText;
$firstValue = reset($bar);
$firstKey = key($bar);
unset($bar[$firstKey]);
$bar = array(
$firstKey => $firstValue,
"Custom" => $wgOut->parse($text)
) + $bar;
return true;
}
Add wikitext to wiki.com/wiki/MediaWiki:Sidebar-Custom
. "Custom" block will be second.
Upvotes: 0