Skip to content

Commit 137afa2

Browse files
author
Mike van den Hoek
committed
(feat): when a field is mapped but there is no value found, set field to read-only
1 parent bc3632a commit 137afa2

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
- tested: WordPress 6.2.2
44

5+
## v1.0.16
6+
7+
### Feat
8+
9+
- When a field is mapped but there is no value found, set field to read-only.
10+
511
## v1.0.15
612

713
### Refactor

prefill-gravity-forms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: Yard | BRP Prefill GravityForms
55
* Plugin URI: https://www.openwebconcept.nl/
66
* Description: Prefill GravityForms fields, based on the dutch BSN number. Retrieve personal information and place these values in the corrensponding fields.
7-
* Version: 1.0.15
7+
* Version: 1.0.16
88
* Author: Yard | Digital Agency
99
* Author URI: https://www.yard.nl/
1010
* License: GPL-3.0
@@ -20,7 +20,7 @@
2020
die;
2121
}
2222

23-
define('PG_VERSION', '1.0.15');
23+
define('PG_VERSION', '1.0.16');
2424
define('PG_DIR', basename(__DIR__));
2525
define('PG_ROOT_PATH', __DIR__);
2626
define('PG_PLUGIN_SLUG', 'prefill-gravity-forms');

src/PrefillGravityForms/Controllers/BaseController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ protected function preFillFields(array $form, array $response): array
6767
{
6868
foreach ($form['fields'] as $field) {
6969
$linkedValue = $field->linkedFieldValue ?? '';
70-
$foundValue = $this->findLinkedValue($linkedValue, $response);
70+
71+
if (empty($linkedValue)) {
72+
continue;
73+
}
74+
75+
$foundValue = $this->findLinkedValue($linkedValue, $response);
7176

7277
if (empty($foundValue)) {
78+
$field->cssClass = 'owc_prefilled'; // When field is mapped but there is no value found, set to read-only.
7379
continue;
7480
}
7581

0 commit comments

Comments
 (0)