Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/321224

Change subject: Add hooks to Special:TrackingCategories
......................................................................

Add hooks to Special:TrackingCategories

Needed to use in the CategoryTree extension to show the category count
on the special page.
See If3815586c2a280b4e8958c13010c9f7436b8723d

Change-Id: If195fb55dee1350a6de095892ce89e6565287cd9
---
M docs/hooks.txt
M includes/specials/SpecialTrackingCategories.php
2 files changed, 17 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/321224/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index 5b707c1..09370ed 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -3217,6 +3217,15 @@
   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
diff --git a/includes/specials/SpecialTrackingCategories.php 
b/includes/specials/SpecialTrackingCategories.php
index 3b502f8..4c6a345 100644
--- a/includes/specials/SpecialTrackingCategories.php
+++ b/includes/specials/SpecialTrackingCategories.php
@@ -87,6 +87,8 @@
                }
                $batch->execute();
 
+               Hooks::run( 'SpecialTrackingCategories::preprocess', [ $this, 
$trackingCategories ] );
+
                foreach ( $trackingCategories as $catMsg => $data ) {
                        $allMsgs = [];
                        $catDesc = $catMsg . '-desc';
@@ -97,11 +99,15 @@
                        );
 
                        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

-- 
To view, visit https://gerrit.wikimedia.org/r/321224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If195fb55dee1350a6de095892ce89e6565287cd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to