aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorRoan Kattouw <catrope@users.mediawiki.org>2011-08-25 09:44:20 +0000
committerRoan Kattouw <catrope@users.mediawiki.org>2011-08-25 09:44:20 +0000
commitb295b9e1e1d48fb0c63bef43ee515721813f2d47 (patch)
tree64d2074b998f4cd07846e712097cbd5be0faa415 /includes
parent641055ebfa542ccd62d539c32c2f07e813781e5f (diff)
downloadmediawikicore-b295b9e1e1d48fb0c63bef43ee515721813f2d47.tar.gz
mediawikicore-b295b9e1e1d48fb0c63bef43ee515721813f2d47.zip
Followup r92155, move preferences-specific code introduced in HTMLForm to Preferences.php. Dropping $displayTitle and replacing it with something else is OK since $displayTitle was introduced as a hack for the preferences form anyway
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/95467
Diffstat (limited to 'includes')
-rw-r--r--includes/HTMLForm.php10
-rw-r--r--includes/Preferences.php2
2 files changed, 7 insertions, 5 deletions
diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index cfaa9c494e93..da84fc30e235 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -681,9 +681,11 @@ class HTMLForm {
/**
* TODO: Document
- * @param $fields
+ * @param $fields array of fields (either arrays or objects)
+ * @param $sectionName string ID attribute of the <table> tag for this section, ignored if empty
+ * @param $fieldsetIDPrefix string ID prefix for the <fieldset> tag of each subsection, ignored if empty
*/
- function displaySection( $fields, $sectionName = '', $displayTitle = false ) {
+ function displaySection( $fields, $sectionName = '', $fieldsetIDPrefix = '' ) {
$tableHtml = '';
$subsectionHtml = '';
$hasLeftColumn = false;
@@ -708,8 +710,8 @@ class HTMLForm {
$section .= $this->mSectionFooters[$key];
}
$attributes = array();
- if ( $displayTitle ) {
- $attributes["id"] = 'prefsection-' . Sanitizer::escapeId( $key, 'noninitial' );
+ if ( $fieldsetIDPrefix ) {
+ $attributes['id'] = Sanitizer::escapeId( "$fieldsetIDPrefix$key" );
}
$subsectionHtml .= Xml::fieldset( $legend, $section, $attributes ) . "\n";
}
diff --git a/includes/Preferences.php b/includes/Preferences.php
index c8d3b50863c6..c999a2ef8177 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -1535,6 +1535,6 @@ class PreferencesForm extends HTMLForm {
* Get the whole body of the form.
*/
function getBody() {
- return $this->displaySection( $this->mFieldTree, '', true );
+ return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
}
}