Manual:Hooks/CustomEditor

From MediaWiki.org
Jump to navigation Jump to search
CustomEditor
Available from version 1.9.1
When invoking the page editor. Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc.
Define function:
public static function onCustomEditor( Page $page, User $user ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"CustomEditor": "MyExtensionHooks::onCustomEditor"
	}
}

For MediaWiki ≤1.25:

$wgHooks['CustomEditor'][] = 'MyExtensionHooks::onCustomEditor';
Called from: File(s): EditAction.php

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

Details[edit]

  • $page - Page being edited
  • $user - User performing the edit