Manual:Hooks/Collation::factory

From MediaWiki.org
Jump to navigation Jump to search
Collation::factory
Available from version 1.18.0 (r91436)
Called if Collation::factory cannot find what class implements a collation.
Define function:
public static function onCollation_factory( $categoryName, &$categoryObj ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"Collation::factory": "MyExtensionHooks::onCollationfactory"
	}
}

For MediaWiki ≤1.25:

$wgHooks['Collation::factory'][] = 'MyExtensionHooks::onCollationfactory';
Called from: File(s): Collation.php

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

Details[edit]

  • $categoryName: A (string) name of the collation requested. What would go in $wgCategoryCollation
  • &$categoryObj: Replace this with an instance of a Collation class that corresponds to $categoryName, if your extension supports the collation given in $categoryName.

Notes[edit]

  • $collationObj must be a subclass of the Collation class in order to be used.