Merge "Pass $context to 'GetPreferences' hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 1 Nov 2018 04:00:23 +0000 (04:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 1 Nov 2018 04:00:23 +0000 (04:00 +0000)
RELEASE-NOTES-1.33
docs/hooks.txt
includes/preferences/DefaultPreferencesFactory.php

index 5ed9d5a..ae1468e 100644 (file)
@@ -21,6 +21,7 @@ production.
 * …
 
 === New features in 1.33 ===
+* The 'GetPreferences' hook now receives an additional $context parameter.
 * …
 
 === External library changes in 1.33 ===
index 14656fa..bd06d52 100644 (file)
@@ -1735,6 +1735,7 @@ $out: OutputPage object (to check what type of page the user is on)
 'GetPreferences': Modify user preferences.
 $user: User whose preferences are being modified.
 &$preferences: Preferences description array, to be fed to an HTMLForm object
+$context: IContextSource object (added in 1.33)
 
 'GetRelativeTimestamp': Pre-emptively override the relative timestamp generated
 by MWTimestamp::getRelativeTimestamp(). Return false in this hook to use the
index 3ec6876..c552506 100644 (file)
@@ -127,7 +127,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                $this->watchlistPreferences( $user, $context, $preferences );
                $this->searchPreferences( $preferences );
 
-               Hooks::run( 'GetPreferences', [ $user, &$preferences ] );
+               Hooks::run( 'GetPreferences', [ $user, &$preferences, $context ] );
 
                $this->loadPreferenceValues( $user, $context, $preferences );
                $this->logger->debug( "Created form descriptor for user '{$user->getName()}'" );