Manual:Hooks/LinkerMakeExternalImage

From MediaWiki.org
Jump to: navigation, search
LinkerMakeExternalImage
Available from version 1.13.0
Called before the HTML for external images is returned, used for modifying external image HTML

Define function:
public static function onLinkerMakeExternalImage( &$url, &$alt, &$img ) { ... }

Attach hook:
$wgHooks['LinkerMakeExternalImage'][] = 'MyExtensionHooks::onLinkerMakeExternalImage';
Called from: Linker.php

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


[edit] Details

  • &$url: The URL of the external image
  • &$alt: The alt text of the image
  • &$img: The image HTML if you choose to override the default.

You need to return false if you want to modify the HTML of external images, returning true will produce the normal external image HTML, regardless of if $img is set to something. Please note that you will need to include all parts of the HTML in $img, including the <img> tag, if you choose to return false.

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox