Jump to content

Manual:Hooks/SkinAfterBottomScripts

From mediawiki.org
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
SkinAfterBottomScripts
Available from version 1.11.0
At the end of Skin::bottomScripts()
Define function:
public static function onSkinAfterBottomScripts( $skin, &$text ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SkinAfterBottomScripts": "MediaWiki\\Extension\\MyExtension\\Hooks::onSkinAfterBottomScripts"
	}
}
Called from: File(s): Skin/Skin.php
Interface: SkinAfterBottomScriptsHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SkinAfterBottomScripts extensions.

Details

  • $skin: Skin object
  • &$text: bottomScripts Text. Append to $text to add additional text/scripts after the stock bottom scripts.

Delete default buttons

$wgHooks["SkinAfterBottomScripts"][] = "AssetsClass::onSkinAfterBottomScripts";

class AssetsClass {

  public static function onSkinAfterBottomScripts( $skin, &$text ) {

    $text = preg_replace("/^mw\.loader\.using\(\"mediawiki\.action\.edit\"[^\n]+\n/m", "", $text);
    return true;

  }

}