Manual:Hooks/FormatAutocomments

From MediaWiki.org
Jump to: navigation, search
FormatAutocomments
Available from version 1.20.0
When an autocomment is formatted by the Linker.
Define function:
public static function onFormatAutocomments( &$comment, $pre, $auto, $post, $title, $local ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"FormatAutocomments": [
			"MyExtensionHooks::onFormatAutocomments"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['FormatAutocomments'][] = 'MyExtensionHooks::onFormatAutocomments';
Called from: File(s): Linker.php

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

Details[edit]

  • &$comment: Reference to the accumulated comment. Initially null, when set the default code will be skipped.
  • $pre: Initial part of the parsed comment before the call to the hook.
  • $auto: The extracted part of the parsed comment before the call to the hook.
  • $post: The final part of the parsed comment before the call to the hook.
  • $title: An optional title object used to links to sections. Can be null.
  • $local: Boolean indicating whether section links should refer to local page.