Topic on Project:Support desk

[RESOLVED] Change contents of Toolbox

4
134.102.229.142 (talkcontribs)

Hey there,

Where is it possible to add/remove entries to the toolbox? Couldn't find the right place now. In Wikimedia:Sidebar is a tag named TOOLBOX but if i edit it there are no changes? maybe it's because i use vector skin?

for any ideas I'd be thankfull

Bryan (talkcontribs)

I believe this one is auto-generated by MediaWiki. You need to write an extension to change it I think.

Seb35 (talkcontribs)

I just wrote a small code snippet for this feature, it could evolve as an extension or perhaps being integrated in the core, but for now it’s just that. See User:Seb35/modifyToolbox.

Celess22 (talkcontribs)

For future travelers. You can add entries via Wikimedia:Sidebar, but the current code has an apparent bug, maybe, introduced around 1.35 or with changes for sidebar cache.

		$sidebar['TOOLBOX'] = $this->makeToolbox(
			$this->buildNavUrls(),
			$this->buildFeedUrls()
		);
		$sidebar['LANGUAGES'] = $this->getLanguages();

Should likely be:

		$sidebar['TOOLBOX'] = array_merge($sidebar['TOOLBOX'], $this->makeToolbox(
			$this->buildNavUrls(),
			$this->buildFeedUrls()
		));
		$sidebar['LANGUAGES'] = array_merge($sidebar['LANGUAGES'], $this->getLanguages());

See: mediawiki-1.36.0-wmf.31/includes/skins/Skin.php


This would unfortunately mean editing core mediawiki.

Just above in the cache callback stub, you can see it call addToSidebar(), which reads the Wikimedia:Sidebar. then in the code i posed above it gets discarded. It is actually reading the TOOLBOX section and doing the work, just throwing it away i presume by accident.

			$bar = [];
			$this->addToSidebar( $bar, 'sidebar' );
			$this->getHookRunner()->onSkinBuildSidebar( $this, $bar );

Reply to "[RESOLVED] Change contents of Toolbox"