'select' => 'HTMLSelectField',
'radio' => 'HTMLRadioField',
'multiselect' => 'HTMLMultiSelectField',
+ 'limitselect' => 'HTMLSelectLimitField',
'check' => 'HTMLCheckField',
'toggle' => 'HTMLCheckField',
'int' => 'HTMLIntField',
* @return string
*/
public function getDisplayFormat() {
- return $this->displayFormat;
+ global $wgHTMLFormAllowTableFormat;
+ $format = $this->displayFormat;
+ if ( !$wgHTMLFormAllowTableFormat && $format === 'table' ) {
+ $format = 'div';
+ }
+ return $format;
}
/**
* @return string HTML.
*/
function getButtons() {
+ global $wgUseMediaWikiUIEverywhere;
$buttons = '';
if ( $this->mShowSubmit ) {
$attribs['class'] = array( 'mw-htmlform-submit' );
+ if ( $this->isVForm() || $wgUseMediaWikiUIEverywhere ) {
+ array_push( $attribs['class'], 'mw-ui-button', 'mw-ui-constructive' );
+ }
+
if ( $this->isVForm() ) {
// mw-ui-block is necessary because the buttons aren't necessarily in an
// immediate child div of the vform.
// @todo Let client specify if the primary submit button is progressive or destructive
array_push(
$attribs['class'],
- 'mw-ui-button',
'mw-ui-big',
- 'mw-ui-constructive',
'mw-ui-block'
);
}
$attrs['id'] = $button['id'];
}
+ if ( $wgUseMediaWikiUIEverywhere ) {
+ if ( isset( $attrs['class' ] ) ) {
+ $attrs['class'] .= ' mw-ui-button';
+ } else {
+ $attrs['class'] = 'mw-ui-button';
+ }
+ }
+
$buttons .= Html::element( 'input', $attrs ) . "\n";
}
// Close enough to a div.
$getFieldHtmlMethod = 'getDiv';
break;
+ case 'div':
+ $getFieldHtmlMethod = 'getDiv';
+ break;
default:
$getFieldHtmlMethod = 'get' . ucfirst( $displayFormat );
}