Add hooks to Special:TrackingCategories
authorUmherirrender <umherirrender_de.wp@web.de>
Sun, 13 Nov 2016 14:53:55 +0000 (15:53 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 13 Nov 2016 15:14:14 +0000 (15:14 +0000)
Added for use in the CategoryTree extension to show the category count
on the special page, see If3815586c2a280b4e8958c13010c9f7436b8723d

Change-Id: If195fb55dee1350a6de095892ce89e6565287cd9

docs/hooks.txt
includes/specials/SpecialTrackingCategories.php

index 5b707c1..09370ed 100644 (file)
@@ -3217,6 +3217,15 @@ $engine: the search engine
   message key to use in the name column,
 $context: IContextSource object
 
+'SpecialTrackingCategories::preprocess': Called after LinkBatch on Special:TrackingCategories
+$specialPage: The SpecialTrackingCategories object
+$trackingCategories: Array of data from Special:TrackingCategories with msg and cats
+
+'SpecialTrackingCategories::generateCatLink': Called for each cat link on Special:TrackingCategories
+$specialPage: The SpecialTrackingCategories object
+$catTitle: The Title object of the linked category
+&$html: The Result html
+
 'SpecialUploadComplete': Called after successfully uploading a file from
 Special:Upload.
 &$form: The SpecialUpload object
index 3b502f8..4c6a345 100644 (file)
@@ -87,6 +87,8 @@ class SpecialTrackingCategories extends SpecialPage {
                }
                $batch->execute();
 
+               Hooks::run( 'SpecialTrackingCategories::preprocess', [ $this, $trackingCategories ] );
+
                foreach ( $trackingCategories as $catMsg => $data ) {
                        $allMsgs = [];
                        $catDesc = $catMsg . '-desc';
@@ -97,11 +99,15 @@ class SpecialTrackingCategories extends SpecialPage {
                        );
 
                        foreach ( $data['cats'] as $catTitle ) {
-                               $catTitleText = Linker::link(
+                               $html = Linker::link(
                                        $catTitle,
                                        htmlspecialchars( $catTitle->getText() )
                                );
-                               $allMsgs[] = $catTitleText;
+
+                               Hooks::run( 'SpecialTrackingCategories::generateCatLink',
+                                       [ $this, $catTitle, &$html ] );
+
+                               $allMsgs[] = $html;
                        }
 
                        # Extra message, when no category was found