Available from version 1.19.0
Override the text used for the <legend> of a preferences section.
Define function:
public static function onPreferencesGetLegend( $form, $key, &$legend ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"PreferencesGetLegend": "MyExtensionHooks::onPreferencesGetLegend"
Called from: File(s): specials/forms/PreferencesFormOOUI.php
Interface: PreferencesGetLegendHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:PreferencesGetLegend extensions.


  • $form: the PreferencesForm object. This is a ContextSource as well.
  • $key: the section name
  • &$legend: the legend text. Defaults to wfMsg( "prefs-$key" ) but may be overridden