Skip to content

Commit fe77ce1

Browse files
author
Roman Gsponer
committed
Downward compatibility
1 parent d58579a commit fe77ce1

File tree

9 files changed

+20
-26
lines changed

9 files changed

+20
-26
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ With the integrated mailview field you can display requests allover the panel.
6464

6565
# Installation
6666

67-
For use with Kirby > 4.0 only!
68-
6967
**Manually**
7068

7169
[Download](https://github.com/youngcut/kirby-form-block-suite/archive/refs/heads/main.zip) and copy the plugin into your plugin folder: `/site/plugins/`
@@ -159,7 +157,7 @@ The placeholders in **Display title** is taken from the data the visitor enter i
159157
|4|Radio| ![radio](./.github/radio.png)|
160158
|5|Checkbox| ![checkbox](./.github/checkbox.png)|
161159
|6|Attachment | ![attachment](./.github/attachment.png)|
162-
|7|Captcha<br>(< 4.2.0) | ![captcha](./.github/captcha.png)|
160+
|7|Captcha | ![captcha](./.github/captcha.png)|
163161

164162
> **Note for attachment field type:** To increase the maximum file size set the `upload_max_filesize`, `post_max_size` and `memory_limit` to desiered values in your php.ini.
165163
@@ -376,7 +374,7 @@ my_custom_message:
376374

377375
```
378376

379-
You can do the same with `form_confirm.yml` and `form_notify.yml`. For example (> v4.1.0), if you like to give the opurtunity to set the reply adress, add these lines to `form_notify.yml`:
377+
You can do the same with `form_confirm.yml` and `form_notify.yml`. For example, if you like to give the opurtunity to set the reply adress, add these lines to `form_notify.yml`:
380378

381379

382380
```xml
@@ -507,7 +505,7 @@ The corresponding function will be no longer executed and in the panel the tab/f
507505

508506
## Email templating
509507

510-
Since Version 4.3.6 you can set the templates for outgoing emails like this:
508+
You can set the templates for outgoing emails like this:
511509

512510
```php
513511
'microman.formblock' => [

classes/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public function message($key, $replaceArray = [], $fallback = null): string
373373
* Get translatin from options or translation files.
374374
*
375375
* @param string $key
376-
* @param string $default if set, return it.
376+
* @param object $default if set, return it.
377377
* @param array $replaceArray Additional array for replacing
378378
*
379379
* @return string

classes/FormBlueprint.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use Kirby\Filesystem\Dir;
1414
use Kirby\Filesystem\F;
15-
use Kirby\Toolkit\Str;
1615
use Kirby\Data\Yaml;
1716

1817
class FormBlueprint

classes/FormField.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
*/
1212

1313
use Kirby\Cms\Block;
14-
use Kirby\Cms\Structure;
14+
use Kirby\Filesystem\F;
1515
use Kirby\Toolkit\A;
1616
use Kirby\Toolkit\V;
17-
use Kirby\Toolkit\F;
1817
use Kirby\Toolkit\Str;
19-
use Kirby\Toolkit\I18n;
2018
use Kirby\Toolkit\Escape;
2119
use Kirby\Http\Request\Files;
2220
use Kirby\Filesystem\Mime;
@@ -36,7 +34,7 @@ class FormField extends Block
3634
/**
3735
* Visitor send some values
3836
*
39-
* @var Bool
37+
* @var Array
4038
*/
4139
protected $errors;
4240

@@ -157,7 +155,7 @@ public function value($raw = false): string
157155

158156

159157
if (!is_null($this->files)) {
160-
return implode(', ', array_map(fn($f) => f::safeName($f['name']), $this->files));
158+
return implode(', ', array_map(fn($f) => F::safeName($f['name']), $this->files));
161159
}
162160

163161
// Prefill value from query string variable matching slug
@@ -455,7 +453,7 @@ public function errorMessage(): string
455453
*/
456454
public function isValid(): bool
457455
{
458-
return count($this->errors) == 0;
456+
return count($this->errors) === 0;
459457
}
460458

461459
/**

classes/FormFields.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use Kirby\Cms\Blocks;
1414
use Kirby\Http\Environment;
15-
use Kirby\Filesystem\F;
1615

1716
class FormFields extends Blocks
1817
{

classes/FormRequest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,9 @@
1010
* @license https://license.microman.ch/license/
1111
*/
1212

13-
use Kirby\Cms\Page;
14-
use Kirby\Cms\Site;
15-
use Kirby\Cms\Template;
1613
use Kirby\Toolkit\I18n;
17-
use Kirby\Toolkit\F;
18-
use Kirby\Uuid\Uuid;
1914
use Kirby\Http\Request\Files;
20-
21-
use Kirby\Exception\Exception;
15+
use Kirby\Filesystem\F;
2216

2317
class FormRequest
2418
{

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "microman/kirby-form-block-suite",
33
"description": "Contactform based on Kirby blocks.",
44
"type": "kirby-plugin",
5-
"version": "5.0.0",
5+
"version": "5.0.1",
66
"license": "proprietary",
77
"authors": [{
88
"name": "Roman Gsponer",

index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Kirby\Cms\App as Kirby;
1010
use Kirby\Data\Data;
1111

12-
Kirby::plugin('microman/formblock', [
12+
$setup = [
1313
'options' => [
1414
'from_email' => 'no-reply@' . Kirby::instance()->environment()->host(),
1515
'placeholders' => FormBlueprint::getPlaceholders(),
@@ -112,5 +112,11 @@
112112
'hu' => Data::read(__DIR__ . '/i18n/hu.json'),
113113
'fr' => Data::read(__DIR__ . '/i18n/fr.json'),
114114
]
115-
],
116-
license: FormLicense::licenseObj());
115+
];
116+
117+
//Extend downwards compatibility
118+
if (version_compare(Kirby::version() ?? '0.0.0', '4.9.9', '>')) {
119+
Kirby::plugin('microman/formblock', $setup, license: FormLicense::licenseObj());
120+
} else {
121+
Kirby::plugin('microman/formblock', $setup);
122+
}

0 commit comments

Comments
 (0)