|
@@ -84,14 +84,14 @@ discard block |
|
|
block discarded – undo |
|
84
|
84
|
Craft::$app->session->setNotice(Craft::t('contact-form-extensions', 'The Contact Form plugin is not installed or activated, Contact Form Extensions does not work without it.')); |
|
85
|
85
|
} |
|
86
|
86
|
|
|
87
|
|
- Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function (RegisterUrlRulesEvent $event) { |
|
|
87
|
+ Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(RegisterUrlRulesEvent $event) { |
|
88
|
88
|
$event->rules = array_merge($event->rules, [ |
|
89
|
89
|
'contact-form-extensions/submissions/<submissionId:\d+>' => 'contact-form-extensions/submissions/show-submission', |
|
90
|
90
|
'contact-form-extensions/submissions/<submissionId:\d+>/<siteHandle:{handle}>' => 'contact-form-extensions/submissions/show-submission', |
|
91
|
91
|
]); |
|
92
|
92
|
}); |
|
93
|
93
|
|
|
94
|
|
- Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND, function (SendEvent $e) { |
|
|
94
|
+ Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND, function(SendEvent $e) { |
|
95
|
95
|
$submission = $e->submission; |
|
96
|
96
|
if ($this->settings->enableDatabase) { |
|
97
|
97
|
$submission = $this->contactFormExtensionsService->saveSubmission($submission); |
|
@@ -115,7 +115,7 @@ discard block |
|
|
block discarded – undo |
|
115
|
115
|
} |
|
116
|
116
|
}); |
|
117
|
117
|
|
|
118
|
|
- Event::on(Mailer::class, Mailer::EVENT_AFTER_SEND, function (SendEvent $e) { |
|
|
118
|
+ Event::on(Mailer::class, Mailer::EVENT_AFTER_SEND, function(SendEvent $e) { |
|
119
|
119
|
if ($this->settings->enableConfirmationEmail) { |
|
120
|
120
|
// First set the template mode to the Site templates |
|
121
|
121
|
Craft::$app->view->setTemplateMode(View::TEMPLATE_MODE_SITE); |
|
@@ -144,7 +144,7 @@ discard block |
|
|
block discarded – undo |
|
144
|
144
|
Event::on( |
|
145
|
145
|
CraftVariable::class, |
|
146
|
146
|
CraftVariable::EVENT_INIT, |
|
147
|
|
- function (Event $event) { |
|
|
147
|
+ function(Event $event) { |
|
148
|
148
|
/** @var CraftVariable $variable */ |
|
149
|
149
|
$variable = $event->sender; |
|
150
|
150
|
$variable->set('contactFormExtensions', ContactFormExtensionsVariable::class); |