Jump to content

Manual:Hooks/SkinAfterBottomScripts

From mediawiki.org
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.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

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

Delete default buttons

[edit]
$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;

  }

}