(bug 29680, bug 22911) Add GetDeaultSortkey hook in order to override default sortkey...
authorBrian Wolff <bawolff@users.mediawiki.org>
Wed, 6 Jul 2011 00:38:40 +0000 (00:38 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Wed, 6 Jul 2011 00:38:40 +0000 (00:38 +0000)
Some people want it to default to subpage or to fullpagename this hook would let
them do what they want :)

RELEASE-NOTES-1.19
docs/hooks.txt
includes/Title.php

index b7397ec..fcb8b39 100644 (file)
@@ -67,6 +67,7 @@ production.
 * (bug 5800) Added $formCallback as a parameter to the hook
   EditPage::showEditForm:initial
 * (bug 29723) mw.util.wikiGetlink() now defaults to wgPageName.
+* (bug 29680) Add GetDefaultSortkey hook to override the default sortkey.
 
 === Bug fixes in 1.19 ===
 * (bug 28868) Show total pages in the subtitle of an image on the
index 004c7e7..f2b5101 100644 (file)
@@ -862,6 +862,10 @@ $out: OutputPage object
 &$cookies: array of cookies name, add a value to it if you want to add a cookie
        that have to vary cache options
 
+'GetDefaultSortkey': Override the default sortkey for a page.
+$title: Title object that we need to get a sortkey for
+&$sortkey: Sortkey to use.
+
 'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
index f170213..5f7c151 100644 (file)
@@ -4247,6 +4247,12 @@ class Title {
         */
        public function getCategorySortkey( $prefix = '' ) {
                $unprefixed = $this->getText();
+
+               // Anything that uses this hook should only depend
+               // on the Title object passed in, and should probably
+               // tell the users to run updateCollations.php --force
+               // in order to re-sort existing category relations.
+               wfRunHooks( 'GetDefaultSortkey', array( $this, &$unprefixed ) );
                if ( $prefix !== '' ) {
                        # Separate with a line feed, so the unprefixed part is only used as
                        # a tiebreaker when two pages have the exact same prefix.