mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FEATURE: Add data and form arguments to Filtered Email Recipients
Most use cases for Filtered Email Recipients will probably require using the data submitted via the user form.
This commit is contained in:
parent
a75937368e
commit
86992971f8
@ -280,10 +280,10 @@ class UserDefinedForm extends Page {
|
|||||||
*
|
*
|
||||||
* @return ArrayList
|
* @return ArrayList
|
||||||
*/
|
*/
|
||||||
public function FilteredEmailRecipients() {
|
public function FilteredEmailRecipients($data = null, $form = null) {
|
||||||
$recipients = new ArrayList($this->getComponents('EmailRecipients')->toArray());
|
$recipients = new ArrayList($this->getComponents('EmailRecipients')->toArray());
|
||||||
|
|
||||||
$this->extend('updateFilteredEmailRecipients', $recipients);
|
$this->extend('updateFilteredEmailRecipients', $recipients, $data, $form);
|
||||||
|
|
||||||
return $recipients;
|
return $recipients;
|
||||||
}
|
}
|
||||||
@ -964,7 +964,7 @@ JS
|
|||||||
);
|
);
|
||||||
|
|
||||||
// email users on submit.
|
// email users on submit.
|
||||||
if($this->FilteredEmailRecipients()) {
|
if($recipients = $this->FilteredEmailRecipients($data, $form)) {
|
||||||
$email = new UserDefinedForm_SubmittedFormEmail($submittedFields);
|
$email = new UserDefinedForm_SubmittedFormEmail($submittedFields);
|
||||||
|
|
||||||
if($attachments){
|
if($attachments){
|
||||||
@ -979,7 +979,7 @@ JS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->FilteredEmailRecipients() as $recipient) {
|
foreach($recipients as $recipient) {
|
||||||
$email->populateTemplate($recipient);
|
$email->populateTemplate($recipient);
|
||||||
$email->populateTemplate($emailData);
|
$email->populateTemplate($emailData);
|
||||||
$email->setFrom($recipient->EmailFrom);
|
$email->setFrom($recipient->EmailFrom);
|
||||||
|
Loading…
Reference in New Issue
Block a user