From: Matthias Schmidt Date: Sun, 20 Dec 2020 10:05:19 +0000 (+0100) Subject: Require label for `CheckboxFormField` X-Git-Tag: 5.3.2~30 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d237d64d0785b9ccd8ccfa14f3c6e5e140b2b126;p=GitHub%2FWoltLab%2FWCF.git Require label for `CheckboxFormField` --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/CheckboxFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/CheckboxFormField.class.php index 7df2a5b09e..495577b3f4 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/CheckboxFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/CheckboxFormField.class.php @@ -12,17 +12,16 @@ use wcf\system\WCF; * @since 5.3 */ class CheckboxFormField extends BooleanFormField { - /** - * @inheritDoc - */ - protected $templateName = '__checkboxFormField'; - /** * @inheritDoc */ public function getHtml() { + if ($this->requiresLabel() && $this->getLabel() === null) { + throw new \UnexpectedValueException("Form field '{$this->getPrefixedId()}' requires a label."); + } + return WCF::getTPL()->fetch( - $this->templateName, + '__checkboxFormField', 'wcf', [ 'field' => $this,