/**
* 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;
$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";
}
* Get the whole body of the form.
*/
function getBody() {
- return $this->displaySection( $this->mFieldTree, '', true );
+ return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
}
}
});
var $a = $( '<a/>', {
text : $legend.text(),
- id : ident.replace('prefsection', 'preftab'),
+ id : ident.replace( 'mw-prefsection', 'preftab' ),
href : '#' + ident
}).click( function( e ) {
e.preventDefault();
// On document ready:
$( function() {
var hash = window.location.hash;
- if( hash.match( /^#prefsection-[\w-]+/ ) ) {
- var $tab = $( hash.replace('prefsection', 'preftab') );
+ if( hash.match( /^#mw-prefsection-[\w-]+/ ) ) {
+ var $tab = $( hash.replace( 'mw-prefsection', 'preftab' ) );
$tab.click();
}
} );