Manual:Hooks/AfterParserFetchFileAndTitle

From MediaWiki.org
Jump to navigation Jump to search
AfterParserFetchFileAndTitle
Available from version 1.24.0 (Gerrit change 140256)
Alter the HTML code of an image gallery. Called after an image gallery is formed by Parser, just before adding its HTML to parser output.
Define function:
public static function onAfterParserFetchFileAndTitle( $parser, $imageGallery, &$html ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"AfterParserFetchFileAndTitle": "MyExtensionHooks::onAfterParserFetchFileAndTitle"
	}
}

For MediaWiki ≤1.25:

$wgHooks['AfterParserFetchFileAndTitle'][] = 'MyExtensionHooks::onAfterParserFetchFileAndTitle';
Called from:File(s): Parser.php
Function(s): renderImageGallery

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

Details[edit]

  • $parser - The Parser object
  • $imageGallery - the gallery object (an ImageGalleryBase subclass)
  • &$html - the HTML code of the gallery