Manual:Hooks/ImageBeforeProduceHTML

From MediaWiki.org
Jump to: navigation, search
ImageBeforeProduceHTML
Available from version 1.13.0
Called before producing the HTML created by a wiki image insertion
Define function:
public static function onImageBeforeProduceHTML( &$skin, &$title, &$file, &$frameParams, &$handlerParams, &$time, &$res ) { ... }
Attach hook:
$wgHooks['ImageBeforeProduceHTML'][] = 'MyExtensionHooks::onImageBeforeProduceHTML';
Called from: File(s): Linker.php

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

Details[edit]

You can skip the default logic entirely by returning false, or just modify a few things using call-by-reference.

  • &$skin: Skin object
  • &$title: Title object of the image
  • &$file: File object, or false if it doesn't exist
  • &$frameParams: Various parameters with special meanings; see documentation in includes/Linker.php for Linker::makeImageLink2
  • &$handlerParams: Various parameters with special meanings; see documentation in includes/Linker.php for Linker::makeImageLink2
  • &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
  • &$res: Final HTML output, used if you return false