return $field;
}
- function getHTML( $submitResult ) {
+ public function getHTML( $submitResult ) {
// This is required for VForm HTMLForms that use that style regardless
// of wgUseMediaWikiUIEverywhere (since they pre-date it).
// When wgUseMediaWikiUIEverywhere is removed, this should be consolidated
protected function getFormAttributes() {
$attribs = parent::getFormAttributes();
- $attribs['class'] = [ 'mw-ui-vform', 'mw-ui-container', 'visualClear' ];
+ $attribs['class'] = [ 'mw-htmlform', 'mw-ui-vform', 'mw-ui-container' ];
return $attribs;
}
- function wrapForm( $html ) {
+ public function wrapForm( $html ) {
// Always discard $this->mWrapperLegend
return Html::rawElement( 'form', $this->getFormAttributes(), $html );
}
- function getButtons() {
+ public function getButtons() {
$buttons = '';
if ( $this->mShowSubmit ) {
) . "\n";
}
+ if ( $this->mShowCancel ) {
+ $target = $this->mCancelTarget ?: Title::newMainPage();
+ if ( $target instanceof Title ) {
+ $target = $target->getLocalURL();
+ }
+ $buttons .= Html::element(
+ 'a',
+ [
+ 'class' => 'mw-ui-button mw-ui-big mw-ui-block',
+ 'href' => $target,
+ ],
+ $this->msg( 'cancel' )->text()
+ ) . "\n";
+ }
+
foreach ( $this->mButtons as $button ) {
$attrs = [
'type' => 'submit',