From e20347614cf0f775be5294005a4806ec027612d2 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 9 Jul 2015 19:08:21 +0200 Subject: [PATCH] HTMLForm: Handle Flags in non-OOUI form buttons, too Flags added to a button or submit field in a non-OOUI form will be handled now, too. With activated wgUseMediaWikiUIEverywhere: All flags will get the 'mw-ui-' prefix. (mw-ui-button is added to the button automatically) With deactivated wgUseMediaWikiUIEverywhere: All flags will get the 'mw-htmlform-' prefix. This allows HTMLForm users to add flags to only the button, without setting them as a cssclas, which would be added to the wrapper elements, too. Bug: T102838 Change-Id: I121a966fb4db6649a6e1012187148d354b5534f0 --- includes/htmlform/HTMLButtonField.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/htmlform/HTMLButtonField.php b/includes/htmlform/HTMLButtonField.php index afd7cf6d12..8d7aec387f 100644 --- a/includes/htmlform/HTMLButtonField.php +++ b/includes/htmlform/HTMLButtonField.php @@ -21,8 +21,20 @@ class HTMLButtonField extends HTMLFormField { } public function getInputHTML( $value ) { + $flags = ''; + $prefix = 'mw-htmlform-'; + if ( $this->mParent instanceof VFormHTMLForm || + $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) + ) { + $prefix = 'mw-ui-'; + // add mw-ui-button separately, so the descriptor doesn't need to set it + $flags .= $prefix.'button'; + } + foreach ( $this->mFlags as $flag ) { + $flags .= ' ' . $prefix . $flag; + } $attr = array( - 'class' => 'mw-htmlform-submit ' . $this->mClass, + 'class' => 'mw-htmlform-submit ' . $this->mClass . $flags, 'id' => $this->mID, ) + $this->getAttributes( array( 'disabled', 'tabindex' ) ); -- 2.20.1