A newer version of
Freeform
is available.
Try Freeform 5 now →
Notification Events
To extend Freeform's Email Notifications, use the events listed below:
Before saving a notification
use Solspace\Freeform\Services\NotificationsService;
use Solspace\Freeform\Events\Notifications\SaveEvent;
Event::on(
NotificationsService::class,
NotificationsService::EVENT_BEFORE_SAVE,
function (SaveEvent $event) {
$notificationRecord = $event->getRecord();
$isNew = $event->isNew();
// Perform some action here
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
After saving a notification
use Solspace\Freeform\Services\NotificationsService;
use Solspace\Freeform\Events\Notifications\SaveEvent;
Event::on(
NotificationsService::class,
NotificationsService::EVENT_AFTER_SAVE,
function (SaveEvent $event) {
$notificationRecord = $event->getRecord();
$isNew = $event->isNew();
// Perform some action here
}
)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Before deleting a notification
use Solspace\Freeform\Services\NotificationsService;
use Solspace\Freeform\Events\Notifications\DeleteEvent;
Event::on(
NotificationsService::class,
NotificationsService::EVENT_BEFORE_DELETE,
function (DeleteEvent $event) {
$notificationRecord = $event->getRecord();
// Perform some action here
}
)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
After deleting a notification
use Solspace\Freeform\Services\NotificationsService;
use Solspace\Freeform\Events\Notifications\DeleteEvent;
Event::on(
NotificationsService::class,
NotificationsService::EVENT_AFTER_DELETE,
function (DeleteEvent $event) {
$notificationRecord = $event->getRecord();
// Perform some action here
}
)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12