Manual:Hooks/PreferencesGetLegend

From Linux Web Expert

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

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:PreferencesGetLegend extensions</tvar>.</translate>


Details

  • $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