function displaySection( $fields ) {
$tableHtml = '';
$subsectionHtml = '';
+ $hasLeftColumn = false;
foreach( $fields as $key => $value ) {
if ( is_object( $value ) ) {
? $this->mFieldData[$key]
: $value->getDefault();
$tableHtml .= $value->getTableRow( $v );
+
+ if ($value->getLabel() != ' ')
+ $hasLeftColumn = true;
} elseif ( is_array( $value ) ) {
$section = $this->displaySection( $value );
$legend = wfMsg( "{$this->mMessagePrefix}-$key" );
}
}
- $tableHtml = "<table><tbody>\n$tableHtml\n</tbody></table>\n";
+ $classes = array();
+ if (!$hasLeftColumn) // Avoid strange spacing when no labels exist
+ $classes[] = 'mw-htmlform-nolabel';
+ $classes = implode( ' ', $classes );
+
+ $tableHtml = "<table class='$classes'><tbody>\n$tableHtml\n</tbody></table>\n";
return $subsectionHtml . "\n" . $tableHtml;
}
td.mw-label { vertical-align: top; width: 20%; }
td.mw-submit { white-space: nowrap; }
+table.mw-htmlform-nolabel td.mw-label { width: 0 !important; }
+
/**
* Image captions
*/