From: Kunal Mehta Date: Thu, 4 Aug 2016 21:48:29 +0000 (-0700) Subject: Provide context in ContributionsToolLinks hook X-Git-Tag: 1.31.0-rc.0~6115^2~3 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=eeac081f27a0fcc9b5a6c02accb0c840b03859ba;p=lhc%2Fweb%2Fwiklou.git Provide context in ContributionsToolLinks hook Most of the hook functions need context to see what the current user's permissions are, to generate messages, or the LinkRenderer service to generate the tool links. Change-Id: I19fa27c8115ee39dded6cb98f29c35b66b934f8a --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 89a54d5c99..79cfb477ed 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1104,6 +1104,9 @@ $row: the DB row for this line $id: User identifier $title: User page title &$tools: Array of tool links +$specialPage: SpecialPage instance for context and services. Can be either + SpecialContributions or DeletedContributionsPage. Extensions should type + hint against a generic SpecialPage though. 'ConvertContent': Called by AbstractContent::convert when a conversion to another content model is requested. diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index cce88b9c2c..d769cb363f 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -392,7 +392,7 @@ class SpecialContributions extends IncludableSpecialPage { ); } - Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools ] ); + Hooks::run( 'ContributionsToolLinks', [ $id, $userpage, &$tools, $this ] ); return $tools; } diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 190bf9f981..a402d3c14a 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -219,7 +219,7 @@ class DeletedContributionsPage extends SpecialPage { ); } - Hooks::run( 'ContributionsToolLinks', [ $id, $nt, &$tools ] ); + Hooks::run( 'ContributionsToolLinks', [ $id, $nt, &$tools, $this ] ); $links = $this->getLanguage()->pipeList( $tools );