mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
parent
6aeca36c32
commit
255ded1542
@ -39,6 +39,17 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
'EmailFrom'
|
'EmailFrom'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setting this to true will allow you to select "risky" fields as
|
||||||
|
* email recipient, such as free-text entry fields.
|
||||||
|
*
|
||||||
|
* It's advisable to leave this off.
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private static $allow_unbound_recipient_fields = false;
|
||||||
|
|
||||||
public function summaryFields() {
|
public function summaryFields() {
|
||||||
$fields = parent::summaryFields();
|
$fields = parent::summaryFields();
|
||||||
if(isset($fields['EmailAddress'])) {
|
if(isset($fields['EmailAddress'])) {
|
||||||
@ -132,8 +143,16 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
);
|
);
|
||||||
$validSubjectFields->merge($multiOptionFields);
|
$validSubjectFields->merge($multiOptionFields);
|
||||||
|
|
||||||
|
|
||||||
|
// Check valid email-recipient fields
|
||||||
|
if($this->config()->allow_unbound_recipient_fields) {
|
||||||
|
// To address can only be email fields or multi option fields
|
||||||
|
$validEmailToFields = ArrayList::create($validEmailFromFields->toArray());
|
||||||
|
$validEmailToFields->merge($multiOptionFields);
|
||||||
|
} else {
|
||||||
// To address cannot be unbound, so restrict to pre-defined lists
|
// To address cannot be unbound, so restrict to pre-defined lists
|
||||||
$validEmailToFields = $multiOptionFields;
|
$validEmailToFields = $multiOptionFields;
|
||||||
|
}
|
||||||
|
|
||||||
// Build fieldlist
|
// Build fieldlist
|
||||||
$fields = FieldList::create(Tabset::create('Root')->addExtraClass('EmailRecipientForm'));
|
$fields = FieldList::create(Tabset::create('Root')->addExtraClass('EmailRecipientForm'));
|
||||||
|
Loading…
Reference in New Issue
Block a user