From 42d5c3f64d8a6266c116e0dddb8584b90bb09c2f Mon Sep 17 00:00:00 2001 From: Leo Koppelkamm Date: Fri, 8 Jul 2011 21:12:10 +0000 Subject: [PATCH] HTMLForm: Add option to output a title for a fieldset & activate it for Special:Pref. Preliminary work for Bug 29672 --- includes/HTMLForm.php | 8 ++++++-- includes/Preferences.php | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index f560590635..c73d536185 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -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"; } } diff --git a/includes/Preferences.php b/includes/Preferences.php index b1274d1826..e36117a3ee 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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 ); + } } -- 2.20.1