Manual:Hooks/GalleryGetModes

From MediaWiki.org
Jump to navigation Jump to search
Other languages:
English • ‎français • ‎čeština • ‎中文
GalleryGetModes
Available from version 1.22.0 (Gerrit change 67885)
Allows extensions to add classes that can render different modes of a gallery.
Define function:
public static function onGalleryGetModes( array &$modeArray ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"GalleryGetModes": "MyExtensionHooks::onGalleryGetModes"
	}
}

For MediaWiki ≤1.25:

$wgHooks['GalleryGetModes'][] = 'MyExtensionHooks::onGalleryGetModes';
Called from:File(s): gallery/ImageGalleryBase.php

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

Details[edit]

Allows an extension to add custom classes to render a gallery with. Add the mode name and the class to the associative array.

  • &$modeArray: An associative array mapping mode names to classes that implement that mode. It is expected all registered classes are a subclass of ImageGalleryBase.