From: Matthias Schmidt Date: Tue, 18 Aug 2020 17:35:29 +0000 (+0200) Subject: Toggling preview button is only possible before building form X-Git-Tag: 5.3.0_Alpha_1~51^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=709b412bf72084e48d408787d8455f9876fcdaed;p=GitHub%2FWoltLab%2FWCF.git Toggling preview button is only possible before building form See #3513 --- diff --git a/wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php index 08267cbf73..aa097ca3eb 100644 --- a/wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/container/wysiwyg/WysiwygFormContainer.class.php @@ -218,11 +218,16 @@ class WysiwygFormContainer extends FormContainer { * * By default, the preview button is shown. * - * @param bool $enablePreviewButton - * @return WysiwygFormContainer this form container + * @param bool $enablePreviewButton + * @return WysiwygFormContainer this form container * @since 5.3 + * @throws \BadMethodCallException if the form field container has already been populated yet */ public function enablePreviewButton($enablePreviewButton = true) { + if ($this->isPopulated) { + throw new \BadMethodCallException('Enabling and disabling the preview button is only possible the form has been built.'); + } + $this->enablePreviewButton = $enablePreviewButton; return $this;