Spezialseiten & Datei hochladen unter Werkzeuge in MediaWiki 1.46 wiederhergestellt (SidebarBeforeOutput)
Deploy Development / deploy (push) Successful in 19s
Deploy Development / deploy (push) Successful in 19s
This commit is contained in:
1 parent
802c777744
commit
b5da977ae1
2 files changed
+40
No files matched your search
@@ -18,6 +18,7 @@
|
||||
"BeforeInitialize": "MediaWiki\\Extension\\KarateMedia\\KarateMediaHooks::onBeforeInitialize",
|
||||
"ParserFirstCallInit": "MediaWiki\\Extension\\KarateMedia\\KarateMediaHooks::onParserFirstCallInit",
|
||||
"ParserPreSaveTransformComplete": "MediaWiki\\Extension\\KarateMedia\\KarateMediaHooks::onParserPreSaveTransformComplete",
|
||||
"SidebarBeforeOutput": "MediaWiki\\Extension\\KarateMedia\\KarateMediaHooks::onSidebarBeforeOutput",
|
||||
"BeforePageDisplay": "MediaWiki\\Extension\\KarateMedia\\KarateMediaHooks::onBeforePageDisplay"
|
||||
},
|
||||
"MediaHandlers": {
|
||||
|
||||
@@ -83,6 +83,45 @@ class KarateMediaHooks {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MediaWiki 1.45+ hat "Spezialseiten" (Special:SpecialPages) und "Datei hochladen" (Special:Upload)
|
||||
* aus dem Standard-TOOLBOX-Block ("Werkzeuge") entfernt. Da das Karate-Wiki eine eigene
|
||||
* MediaWiki:Sidebar nutzt, fuegen wir beide Links hier wieder fest unter "Werkzeuge" ein.
|
||||
*/
|
||||
public static function onSidebarBeforeOutput( $skin, &$sidebar ): void {
|
||||
if ( !$skin->getUser()->isRegistered() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !isset( $sidebar['TOOLBOX'] ) || !is_array( $sidebar['TOOLBOX'] ) ) {
|
||||
$sidebar['TOOLBOX'] = [];
|
||||
}
|
||||
|
||||
$existingIds = [];
|
||||
foreach ( $sidebar['TOOLBOX'] as $key => $item ) {
|
||||
$existingIds[$key] = true;
|
||||
if ( isset( $item['id'] ) ) {
|
||||
$existingIds[$item['id']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset( $existingIds['upload'] ) && !isset( $existingIds['t-upload'] ) ) {
|
||||
$sidebar['TOOLBOX']['upload'] = [
|
||||
'id' => 't-upload',
|
||||
'text' => $skin->msg( 'upload' )->text(),
|
||||
'href' => SpecialPage::getTitleFor( 'Upload' )->getLocalURL(),
|
||||
];
|
||||
}
|
||||
|
||||
if ( !isset( $existingIds['specialpages'] ) && !isset( $existingIds['t-specialpages'] ) ) {
|
||||
$sidebar['TOOLBOX']['specialpages'] = [
|
||||
'id' => 't-specialpages',
|
||||
'text' => $skin->msg( 'specialpages' )->text(),
|
||||
'href' => SpecialPage::getTitleFor( 'Specialpages' )->getLocalURL(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt CSS und JS fuer die Video-Steuerung sowie die gestaltete Vereins-Anmeldeseite.
|
||||
* Fängt auch MediaWikis interne "Special:Badtitle" ("Anmeldung erforderlich") Seite ab
|
||||
|
||||
Reference in new issue
Block a user