From 95946251153044eb5532d249a717d5849a432c4c Mon Sep 17 00:00:00 2001 From: Myles Beardsmore Date: Tue, 23 Jun 2015 23:06:09 +1200 Subject: [PATCH] Added config setting for warning message. Set warning message to false by default --- code/model/UserDefinedForm.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 6b1d269..25724a1 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -59,6 +59,18 @@ class UserDefinedForm extends Page { "EmailRecipients" => "UserDefinedForm_EmailRecipient" ); + /** + * @var Boolean + */ + private static $recipients_warning_enabled = false; + + /** + * @return Boolean + */ + public static function set_recipients_warning_enabled($bool = true) { + self::$recipients_warning_enabled = $bool; + } + /** * Temporary storage of field ids when the form is duplicated. * Example layout: array('EditableCheckbox3' => 'EditableCheckbox14') @@ -182,7 +194,7 @@ SQL; $fields = parent::getCMSFields(); - if($this->EmailRecipients()->Count() == 0) { + if($this->EmailRecipients()->Count() == 0 && UserDefinedForm::config()->recipients_warning_enabled) { $fields->addFieldToTab("Root.Main", new LiteralField("EmailRecipientsWarning", "

" . _t("UserDefinedForm.NORECIPIENTS", "Warning: You have not configured any recipients. Form submissions may be missed.")