Introduce the PreferencesGetLegend hook. I need this to customize the labels of ...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 31 Oct 2011 12:36:51 +0000 (12:36 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 31 Oct 2011 12:36:51 +0000 (12:36 +0000)
docs/hooks.txt
includes/Preferences.php

index 7eeed9f..17e8c26 100644 (file)
@@ -1486,6 +1486,10 @@ $subject : subject of the new section
 &$text : text of the new section
 Return false and put the merged text into $text to override the default behavior.
 
+'PreferencesGetLegend': Override the text used for the <legend> of a preferences section
+$key: the section name
+&$legend: the legend text. Defaults to wfMsg( "prefs-$key" ) but may be overridden
+
 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
 AJAX search suggestions. Put results into &$results outparam and return false.
 $ns : array of int namespace keys to search in
index 853643c..6b2d919 100644 (file)
@@ -1565,4 +1565,14 @@ class PreferencesForm extends HTMLForm {
        function getBody() {
                return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
        }
+       
+       /**
+        * Get the <legend> for a given section key. Normally this is the
+        * prefs-$key message but we'll allow extensions to override it.
+        */
+       function getLegend( $key ) {
+               $legend = parent::getLegend( $key );
+               wfRunHooks( 'PreferencesGetLegend', array( $key, &$legend ) );
+               return $legend;
+       }
 }