jenkins-bot has submitted this change and it was merged.
Change subject: Don't add label-elements for elements that doesn't have one
......................................................................
Don't add label-elements for elements that doesn't have one
Fix the OOUI field element implementation to conditionally add
labels to the FieldLayout (only if the label isn't empty). Also
add setShowEmptyLabel( false ) to HTMLButtonField (labels usually
aren't set outside of the button, the button itself should have a label).
Bug: T129821
Change-Id: I0499bb82245273519e77c80e78bc431588875a85
---
M includes/htmlform/HTMLButtonField.php
M includes/htmlform/HTMLFormField.php
2 files changed, 8 insertions(+), 1 deletion(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/htmlform/HTMLButtonField.php
b/includes/htmlform/HTMLButtonField.php
index 0b07765..16417fc 100644
--- a/includes/htmlform/HTMLButtonField.php
+++ b/includes/htmlform/HTMLButtonField.php
@@ -56,6 +56,8 @@
$this->buttonLabel = $info['buttonlabel-raw'];
}
+ $this->setShowEmptyLabel( false );
+
parent::__construct( $info );
}
diff --git a/includes/htmlform/HTMLFormField.php
b/includes/htmlform/HTMLFormField.php
index 6e5d656..a9c7632 100644
--- a/includes/htmlform/HTMLFormField.php
+++ b/includes/htmlform/HTMLFormField.php
@@ -610,12 +610,17 @@
$config = [
'classes' => [ "mw-htmlform-field-$fieldType",
$this->mClass ],
'align' => $this->getLabelAlignOOUI(),
- 'label' => new OOUI\HtmlSnippet( $this->getLabel() ),
'help' => $helpText !== null ? new OOUI\HtmlSnippet(
$helpText ) : null,
'errors' => $errors,
'infusable' => $infusable,
];
+ // the element could specify, that the label doesn't need to be
added
+ $label = $this->getLabel();
+ if ( $label ) {
+ $config['label'] = new OOUI\HtmlSnippet( $label );
+ }
+
return $this->getFieldLayoutOOUI( $inputField, $config );
}
--
To view, visit https://gerrit.wikimedia.org/r/277177
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0499bb82245273519e77c80e78bc431588875a85
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits