HTMLForm: Add option to output a title for a fieldset & activate it for Special:Pref...
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Fri, 8 Jul 2011 21:12:10 +0000 (21:12 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Fri, 8 Jul 2011 21:12:10 +0000 (21:12 +0000)
includes/HTMLForm.php
includes/Preferences.php

index f560590..c73d536 100644 (file)
@@ -676,7 +676,7 @@ class HTMLForm {
         * TODO: Document
         * @param $fields
         */
-       function displaySection( $fields, $sectionName = '' ) {
+       function displaySection( $fields, $sectionName = '', $displayTitle = false ) {
                $tableHtml = '';
                $subsectionHtml = '';
                $hasLeftColumn = false;
@@ -699,7 +699,11 @@ class HTMLForm {
                                if ( isset( $this->mSectionFooters[$key] ) ) {
                                        $section .= $this->mSectionFooters[$key];
                                }
-                               $subsectionHtml .= Xml::fieldset( $legend, $section ) . "\n";
+                               $attributes = array();
+                               if ( $displayTitle ) { 
+                                       $attributes["title"] = $key; 
+                               }
+                               $subsectionHtml .= Xml::fieldset( $legend, $section, $attributes ) . "\n";
                        }
                }
 
index b1274d1..e36117a 100644 (file)
@@ -1520,4 +1520,10 @@ class PreferencesForm extends HTMLForm {
 
                return $data;
        }
+       /**
+        * Get the whole body of the form.
+        */
+       function getBody() {
+               return $this->displaySection( $this->mFieldTree, '', true );
+       }
 }