Added config setting for warning message. Set warning message to false by default

This commit is contained in:
Myles Beardsmore 2015-06-23 23:06:09 +12:00
parent a31f717774
commit 9594625115

View File

@ -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",
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
"Warning: You have not configured any recipients. Form submissions may be missed.")