From d237d64d0785b9ccd8ccfa14f3c6e5e140b2b126 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 20 Dec 2020 11:05:19 +0100 Subject: [PATCH] Require label for `CheckboxFormField` --- .../form/builder/field/CheckboxFormField.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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, -- 2.20.1