How to customize Preferences

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to customize Preferences

Sam Wilson
Hi all,

(Reposting here to
garner more input.)

I'm working on Extension:GlobalPreferences and trying to figure out how
best to do things with all preferences, after they've been defined (in
order to show various extra Preferences-form bits and pieces that depend
on knowing about all preferences). At the moment, we're using
$wgExtensionFunctions and hacking the $wgHooks global to add a new
callback at the end of $wgHooks['GetPreferences'].

One idea is to add a new MediaWiki service called 'PreferencesFactory',
that can be used to retrieve a new Preferences object. Extensions would
then be able to use the MediaWikiServices hook to redefine the
PreferencesFactory (with MediaWikiServices::redefineService()). Of
course, only one extension would be able to do that (which maybe is a
bit odd).

Apart from being able to override the Preferences class, a service for
this would also mean the Preferences class could be refactored
(gradually?) to not be such a collection of static methods.

The proposed patch is:

I'd love to hear anyone's ideas about this, including completely
different and better ways to do things. :-)

Another idea is to add a new hook, after GetPreferences. This wouldn't
be as flexible as the PreferencesFactory idea, but is a lot simpler.


Wikitech-l mailing list
[hidden email]