Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Hooks/LinkerMakeExternalImage

From mediawiki.org
<Manual:Hooks
LinkerMakeExternalImage
Available fromversion 1.13.0
Called before the HTML forexternal images is returned, used for modifying external image HTML
Define function:
publicstaticfunctiononLinkerMakeExternalImage(&$url,&$alt,&$img){...}
Attach hook:Inextension.json:
{"Hooks":{"LinkerMakeExternalImage":"MediaWiki\\Extension\\MyExtension\\Hooks::onLinkerMakeExternalImage"}}
Called from:File(s):Linker.php
Interface:LinkerMakeExternalImageHook.php

For more information about attaching hooks, seeManual:Hooks.
For examples of extensions using this hook, seeCategory:LinkerMakeExternalImage extensions.

Details

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

You need to returnfalse 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.

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/LinkerMakeExternalImage&oldid=4432515"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp