Manual:Hooks/BeforeGalleryFindFile

From MediaWiki.org
Jump to navigation Jump to search
BeforeGalleryFindFile
Available from version 1.10.1
Removed in version 1.18.0
Allows extensions to specify a specific version of an image to display in a gallery.
Define function:
public static function onBeforeGalleryFindFile( $imagegallery, $title, $time ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"BeforeGalleryFindFile": "MyExtensionHooks::onBeforeGalleryFindFile"
	}
}

For MediaWiki ≤1.25:

$wgHooks['BeforeGalleryFindFile'][] = 'MyExtensionHooks::onBeforeGalleryFindFile';
Called from:File(s): ImageGallery.php

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

Details[edit]

  • $imagegallery - The ImageGallery object.
  • $title - The title object of the image.
  • $time - The time the image was uploaded.

To specify a specific instance of the file to use in the gallery, an extension must set the $title and the $time to correct values for a revision of the file.