A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Hooks/GetDefaultSortkey below:

Manual:Hooks/GetDefaultSortkey - MediaWiki

GetDefaultSortkey Available from version 1.18.0 (r91510, CodeReview archive)
Called when determining what the default sortkey would be for a page
Define function:
public static function onGetDefaultSortkey( $title, &$sortkey ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"GetDefaultSortkey": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetDefaultSortkey"
	}
}
Called from: File(s): Title.php Interface: GetDefaultSortkeyHook.php

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

After adding an extension that uses this hook, you should run php updateCollation.php --force to re-sort any existing category entries. What the default sortkey for a page is, is not stored in the DB, so things won't get updated until the category is removed and re-added to a page, or the maintenance script is run.

This should not use any information that could change other than the title object, because such sortkeys are only re-calculated on page moves or if the category is removed and re-added.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4