skydiver / october-plugin-forms

Create easy (and almost magic) AJAX forms
https://octobercms.com/plugin/martin-forms
MIT License
60 stars 41 forks source link

Limit FormExtender afterSaveRecord to group #156

Closed willouch closed 5 years ago

willouch commented 5 years ago

Hi,

How limit an event to specific group like :

Event::listen('martin.forms.afterSaveRecord', function (&$formdata, $component){ if($component->group == 'myGroup'){ Mail::send('martin.formsextender::mail.notification', $formdata, function($message) { $message->to('mail@mail.fr', 'Admin Person'); }); } }

Thks

willouch commented 5 years ago

I am using alias!!!! and it's works!

if($component->alias == 'myGroup'){ Mail::send('martin.formsextender::mail.notification', $formdata, function($message) { $message->to('mail@mail.fr', 'Admin Person'); });