|
@@ -84,7 +84,7 @@ 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(View::class, View::EVENT_BEFORE_RENDER_TEMPLATE, function (TemplateEvent $e) { |
|
|
87
|
+ Event::on(View::class, View::EVENT_BEFORE_RENDER_TEMPLATE, function(TemplateEvent $e) { |
|
88
|
88
|
if ( |
|
89
|
89
|
$e->template === 'settings/plugins/_settings' && |
|
90
|
90
|
$e->variables['plugin'] === $this |
|
@@ -97,14 +97,14 @@ discard block |
|
|
block discarded – undo |
|
97
|
97
|
} |
|
98
|
98
|
}); |
|
99
|
99
|
|
|
100
|
|
- Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function (RegisterUrlRulesEvent $event) { |
|
|
100
|
+ Event::on(UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(RegisterUrlRulesEvent $event) { |
|
101
|
101
|
$event->rules = array_merge($event->rules, [ |
|
102
|
102
|
'contact-form-extensions/submissions/<submissionId:\d+>' => 'contact-form-extensions/submissions/show-submission', |
|
103
|
103
|
'contact-form-extensions/submissions/<submissionId:\d+>/<siteHandle:{handle}>' => 'contact-form-extensions/submissions/show-submission', |
|
104
|
104
|
]); |
|
105
|
105
|
}); |
|
106
|
106
|
|
|
107
|
|
- Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND, function (SendEvent $e) { |
|
|
107
|
+ Event::on(Mailer::class, Mailer::EVENT_BEFORE_SEND, function(SendEvent $e) { |
|
108
|
108
|
if ($this->settings->recaptcha) { |
|
109
|
109
|
$recaptcha = $this->contactFormExtensionsService->recaptcha; |
|
110
|
110
|
$captchaResponse = Craft::$app->request->getParam('g-recaptcha-response'); |
|
@@ -140,7 +140,7 @@ discard block |
|
|
block discarded – undo |
|
140
|
140
|
} |
|
141
|
141
|
}); |
|
142
|
142
|
|
|
143
|
|
- Event::on(Mailer::class, Mailer::EVENT_AFTER_SEND, function (SendEvent $e) { |
|
|
143
|
+ Event::on(Mailer::class, Mailer::EVENT_AFTER_SEND, function(SendEvent $e) { |
|
144
|
144
|
if ($this->settings->enableConfirmationEmail) { |
|
145
|
145
|
// First set the template mode to the Site templates |
|
146
|
146
|
Craft::$app->view->setTemplateMode(View::TEMPLATE_MODE_SITE); |
|
@@ -169,7 +169,7 @@ discard block |
|
|
block discarded – undo |
|
169
|
169
|
Event::on( |
|
170
|
170
|
CraftVariable::class, |
|
171
|
171
|
CraftVariable::EVENT_INIT, |
|
172
|
|
- function (Event $event) { |
|
|
172
|
+ function(Event $event) { |
|
173
|
173
|
/** @var CraftVariable $variable */ |
|
174
|
174
|
$variable = $event->sender; |
|
175
|
175
|
$variable->set('contactFormExtensions', ContactFormExtensionsVariable::class); |