This affects Special:Preferences, where there will no longer be an
empty <table class="mw-htmlform-nolabel"><tbody></tbody></table>
after every toplevel section heading.
Change-Id: Icb6fe957024843f2b08720715054b9afb657f395
* @return string HTML
*/
protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+ if ( !$fieldsHtml ) {
+ // Do not generate any wrappers for empty sections. Sections may be empty if they only have
+ // subsections, but no fields. A legend will still be added in wrapFieldSetSection().
+ return '';
+ }
+
$displayFormat = $this->getDisplayFormat();
$html = implode( '', $fieldsHtml );
* @return string HTML
*/
protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+ if ( !$fieldsHtml ) {
+ // Do not generate any wrappers for empty sections. Sections may be empty if they only have
+ // subsections, but no fields. A legend will still be added in wrapFieldSetSection().
+ return '';
+ }
+
$config = [
'items' => $fieldsHtml,
];