mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #157 from mi3ll/filtered-email-recipients
NEW: Additional arguments for filtered email recipients
This commit is contained in:
commit
b2b030366b
@ -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