Commit | Line | Data |
---|---|---|
bdf67e28 SL |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
6 | | This work is published under the GNU AGPLv3 license with some | | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
9 | +--------------------------------------------------------------------+ | |
10 | */ | |
11 | namespace Civi\FlexMailer\Listener; | |
12 | ||
13 | use Civi\FlexMailer\Event\ComposeBatchEvent; | |
14 | ||
15 | class Attachments extends BaseListener { | |
16 | ||
17 | /** | |
18 | * Add any attachments. | |
19 | * | |
20 | * @param \Civi\FlexMailer\Event\ComposeBatchEvent $e | |
21 | */ | |
22 | public function onCompose(ComposeBatchEvent $e) { | |
23 | if (!$this->isActive()) { | |
24 | return; | |
25 | } | |
26 | ||
27 | foreach ($e->getTasks() as $task) { | |
28 | /** @var \Civi\FlexMailer\FlexMailerTask $task */ | |
29 | $task->setMailParam('attachments', $e->getAttachments()); | |
30 | } | |
31 | } | |
32 | ||
33 | } |