mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Added config setting for warning message. Set warning message to false by default
This commit is contained in:
parent
a31f717774
commit
9594625115
@ -59,6 +59,18 @@ class UserDefinedForm extends Page {
|
|||||||
"EmailRecipients" => "UserDefinedForm_EmailRecipient"
|
"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.
|
* Temporary storage of field ids when the form is duplicated.
|
||||||
* Example layout: array('EditableCheckbox3' => 'EditableCheckbox14')
|
* Example layout: array('EditableCheckbox3' => 'EditableCheckbox14')
|
||||||
@ -182,7 +194,7 @@ SQL;
|
|||||||
|
|
||||||
$fields = parent::getCMSFields();
|
$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",
|
$fields->addFieldToTab("Root.Main", new LiteralField("EmailRecipientsWarning",
|
||||||
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
|
"<p class=\"message warning\">" . _t("UserDefinedForm.NORECIPIENTS",
|
||||||
"Warning: You have not configured any recipients. Form submissions may be missed.")
|
"Warning: You have not configured any recipients. Form submissions may be missed.")
|
||||||
|
Loading…
Reference in New Issue
Block a user