Skip to content

Commit 1964c90

Browse files
2 Bugfix
- Failed Validation if dynamic_validation is disabled - Fix return "en" if message not exist.
1 parent aff687c commit 1964c90

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

classes/Form.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function message($key, $replaceArray = []): string
313313

314314
$text = $this->__call($key)
315315
->or(option('microman.formblock.translations.' . $this->getLang() . '.' .$key))
316-
->or(I18n::translate('form.block.' . $key, $locale = $this->getLang()));
316+
->or(I18n::translate('form.block.' . $key, $this->content()->$key(), $this->getLang()));
317317

318318
return Str::template($text, A::merge($this->fieldsWithPlaceholder('value'), $replaceArray));
319319

@@ -523,6 +523,7 @@ public function sendConfirmation($body = NULL, $reply =NULL)
523523
$reply = $this->message('confirm_email');
524524
}
525525

526+
526527
try {
527528

528529
$emailData = [
@@ -583,12 +584,12 @@ private function runProcess()
583584
}
584585

585586
// Send notification mail
586-
if (!option('microman.formblock.disable_notify') && !$this->isFatal()) {
587+
if (!option('microman.formblock.disable_notify') && !$this->isFatal() && $this->enable_notify()->isTrue()) {
587588
$this->sendNotification();
588589
}
589590

590-
// Send notification mail
591-
if (!option('microman.formblock.disable_confirmation') && !$this->isFatal()) {
591+
// Send confirmation mail
592+
if (!option('microman.formblock.disable_confirmation') && !$this->isFatal() && $this->enable_confirm()->isTrue()) {
592593
$this->sendConfirmation();
593594
}
594595

index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
'file_maxnumber' => 'No more than {{maxnumber}} may be uploaded.',
3535
'file_required' => 'Choose at least one File to upload.',
3636
'invalid_message' => '<p>Please check these fields: {{ fields }}.</p>',
37-
'notify_body' => '<p>{{ given-name }} send a request:</p><p>{{ summary }}</p>',
37+
'notify_body' => '<p>{{ name }} send a request:</p><p>{{ summary }}</p>',
3838
'notify_subject' => 'Request from website.',
3939
'send_button' => 'Send',
40-
'success_message' => '<p>Thank you {{ given-name }}. We will get back to you as soon as possible.</p>',
40+
'success_message' => '<p>Thank you {{ name }}. We will get back to you as soon as possible.</p>',
4141

4242
],
4343
'de' => [
44-
'confirm_body' => 'Danke {{ given-name }}. Wir werden uns schnellst möglich bei dir melden.',
44+
'confirm_body' => 'Danke {{ name }}. Wir werden uns schnellst möglich bei dir melden.',
4545
'confirm_subject' => 'Deine Anfrage',
4646
'exists_message' => 'Das Formular wurde bereits ausgefüllt.',
4747
'fatal_message' => 'Es ist etwas schief gelaufen. Kontaktieren Sie den Administrator oder versuchen Sie es später noch einmal.',
@@ -51,10 +51,10 @@
5151
'file_maxnumber' => 'Es dürfen nicht mehr als {{maxnumber}} hochgeladen werden.',
5252
'file_required' => 'Wähle mindestens eine Datei zum Hochladen aus.',
5353
'invalid_message' => 'Bitte überprüfen Sie diese Felder: {{ fields }}.',
54-
'notify_body' => '<p>{{ given-name }} hat eine Anfrage gesendet:</p><p>{{ summary }}</p>',
54+
'notify_body' => '<p>{{ name }} hat eine Anfrage gesendet:</p><p>{{ summary }}</p>',
5555
'notify_subject' => 'Anfrage aus der Webseite.',
5656
'send_button' => 'Senden',
57-
'success_message' => 'Danke {{ given-name }}. Wir werden uns schnellst möglich bei dir melden.',
57+
'success_message' => 'Danke {{ name }}. Wir werden uns schnellst möglich bei dir melden.',
5858
]
5959
],
6060
],

snippets/blocks/form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
<div class="form-block-button form-block-submit column">
4343
<input type="submit" value="<?= $form->message('send_button') ?>">
4444
</div>
45+
46+
<input type="hidden" name="id" value="<?= $form->id() ?>">
4547
</form>
4648
<?php endif ?>
4749

0 commit comments

Comments
 (0)