Manual:Hooks/Collation::factory

From Linux Web Expert

Collation::factory
<translate> Available from <tvar name=1><translate> version <tvar (r91436, codereview)</tvar></translate>
Called if Collation::factory cannot find what class implements a collation.
<translate> Define function:</translate>
public static function onCollation_factory( $categoryName, &$categoryObj ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"Collation::factory": "MediaWiki\\Extension\\MyExtension\\Hooks::onCollationfactory"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> collation/Collation.php
<translate> Interface:</translate> Collation__factoryHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:Collation::factory extensions</tvar>.</translate>


Details

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

Notes

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