Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0aa345a
feat: upgrade to php8
Apr 30, 2025
2b4ced8
feat: user object model class
Nov 19, 2025
17b8d54
feat: conditional usage of ssl certificates
Jan 7, 2026
36fa542
refactor: update block registration + prefix to make blocks visible i…
Jan 8, 2026
be45b61
fix: remove some default values in GFAddon settings
Jan 8, 2026
c6c1cc6
fix: validate certificates and their paths
mvdhoek1 Jan 21, 2026
417fe16
fix: personal data row inner block
mvdhoek1 Feb 5, 2026
4f469d0
fix: make sure getValueFromNestedArray() returns string in PersonalDa…
mvdhoek1 Feb 12, 2026
2238baa
fix: mapping options vrijbrp
mvdhoek1 Feb 18, 2026
931c7af
refactor: snake_case to camelCase
mvdhoek1 Feb 19, 2026
867aef4
chore(8343): add missing information to personal data block for mijng…
Rovasch Feb 27, 2026
e3e59dd
refactor: pr comments
Rovasch Feb 27, 2026
ca1d728
chore: run composer format script
mvdhoek1 Mar 3, 2026
21d2448
chore: remove EnableU as supplier with exceptions
mvdhoek1 Mar 4, 2026
fc89ca3
feat: add fullName class method to UserModel
mvdhoek1 Mar 4, 2026
ca00864
fix: usage of SSL certs in WeAreFrankController
mvdhoek1 Mar 9, 2026
3b46225
feat: add mTLS certificate configuration with passphrase support and …
mvdhoek1 Mar 10, 2026
f97d6b5
refactor: verify SSL peer and host when using client certificates
mvdhoek1 Mar 10, 2026
3942a1b
feat: expand UserModel class
mvdhoek1 Mar 12, 2026
0c44d46
feat: upgrade to php8
Apr 30, 2025
2a4cfd1
refactor: update block registration + prefix to make blocks visible i…
Jan 8, 2026
473e520
feat: Pink and EnableU v2 implementation
Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
!.gitignore

!.php-cs-fixer.php
.php-cs-fixer.cache

# Eslint
!.eslintrc
Expand Down Expand Up @@ -64,6 +65,7 @@ Thumbs.db
*.log
*.sql
*.sqlite
pg-log-*.json

# ignore compiled files
*.com
Expand Down
69 changes: 35 additions & 34 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->notPath('vendor')
->notPath('node_modules')
->in(__DIR__)
->in('./resources/views')
->in('./config')
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
->notPath('vendor')
->notPath('node_modules')
->in(__DIR__)
->in('./resources/views')
->in('./config')
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config)
->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'no_unused_imports' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=>' => null,
'|' => 'no_space',
],
],
'full_opening_tag' => true,
'yoda_style' => [
'always_move_variable' => true,
'equal' => true,
'identical' => true,
'less_and_greater' => true,
],
])
->setFinder($finder);
->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'no_unused_imports' => true,
'array_indentation' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=>' => 'single_space',
'|' => 'no_space',
],
],
'full_opening_tag' => true,
'yoda_style' => [
'always_move_variable' => true,
'equal' => true,
'identical' => true,
'less_and_greater' => true,
],
])
->setFinder($finder);
82 changes: 74 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

## Description

Prefill GravityForms fields, based on the dutch BSN number. Retrieve personal information and place these values in the corrensponding fields.
Prefill GravityForms fields, based on the Dutch BSN number. Retrieve personal information and place these values in the corrensponding fields.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misschien wat miereneukerig 😶 :
Retrieves personal information and places these values in the corrensponding fields.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Altijd blijven mierenneuken 🐜


## Dependencies

In order to use this plug-in there are two required plug-ins:
To use this plug-in, the following dependencies are required:

- GravityForms (premium)
- Yard | GravityForms DigiD (private repo, contact [Yard | Digital Agency](https://www.yard.nl/) for access)

See [here](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/main/config/core.php) for more details.
In addition, at least one of the following plug-ins must be installed to enable authentication by BSN:

- Yard | GravityForms DigiD (<https://github.com/yardinternet/owc-gravityforms-digid>)
- OWC Signicat OpenID (<https://github.com/yardinternet/plugin-owc-signicat-openid>)

## Features

Expand Down Expand Up @@ -39,14 +41,14 @@ See [here](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/m

1. Go to '/wp-admin/admin.php?page=gf_settings&subview=owc-gravityforms-iconnect' and configure all the required settings.

- 1. Suppliers will provide the needed certificates which need to be selected in order to make prefilling form fields work.
- 2. Suppliers will also provide an API-key, certificates password (if needed) and a base URL.
- 3. [OIN](https://logius.nl/domeinen/toegang/organisatie-identificatienummer/wat-is-het) is a unique number for organizations provided by Logius.
- 1. Suppliers will provide the needed certificates which need to be selected in order to make prefilling form fields work.
- 2. Suppliers will also provide an API-key, certificates password (if needed) and a base URL.
- 3. [OIN](https://logius.nl/domeinen/toegang/organisatie-identificatienummer/wat-is-het) is a unique number for organizations provided by Logius.

2. Go to the form settings of the form you want to configure.
3. Scroll down and look for the 'iConnect' panel and configure the settings.

### 🔐 Cache Encryption
### Cache Encryption

To enable secure caching of sensitive data, you **must define an encryption key** in your `wp-config.php` file. This key is used to encrypt and decrypt the cached data and should be kept secret at all times.

Expand All @@ -66,3 +68,67 @@ Important:
## License

The source code is made available under the [EUPL 1.2 license](https://github.com/OpenWebconcept/plugin-prefill-gravity-forms/blob/main/LICENSE.md). Some of the dependencies are licensed differently, with the BSD or MIT license, for example.

## User model

The `UserModel` provides a simple way to access BRP (Basisregistratie Personen) data that has been retrieved after a valid DigiD login.
It automatically detects which data supplier is configured (in the add-on settings), loads the correct controller, and exposes a small set of helper methods for use in templates or form-prefill logic.

Before accessing any user attributes, always check whether the user is authenticated using DigiD.

### Usage

```php
$user = new \OWC\PrefillGravityForms\Models\UserModel();

if ( $user->isLoggedIn() ) {
$bsn = $user->bsn();
$age = $user->age();
}
```

This model does not handle authentication itself, it only exposes data retrieved by the underlying BRP supplier controller.
If a controller fails to load (e.g., misconfiguration or missing supplier), the model gracefully returns default values.

To use this model, make sure it is enabled in the settings available at '/wp-admin/admin.php?page=gf_settings&subview=owc-gravityforms-iconnect'.
Otherwise, the object will be instantiated but will not contain any data.

## Logging

Enable logging to monitor errors during communication with the BRP suppliers.

- Logs are written daily to `pg-log{-date}.json` in the WordPress webroot directory.
- A rotating file handler keeps up to 7 log files by default, deleting the oldest as needed.
- You can change the maximum number of log files using the filter described below.

## Hooks

### Change the maximum number of log files

Use the following filter to alter the rotating file handler's max files setting:

```php
apply_filters('pg::logger/rotating_filer_handler_max_files', PG_LOGGER_DEFAULT_MAX_FILES)
```

### Intercept exceptions for custom handling

You can intercept exceptions caught by the plugin for additional processing or custom logging using this filter:

```php
do_action('pg::exception/intercept', $exception, $method)
```

The `$exception` parameter contains the caught exception object.

### Provide Custom Mapping Options from a Theme Directory

This plugin includes supplier-specific mapping option files. In version 1 of the "HaalCentraal API", all available fields were returned, even when only a subset was needed.

Since version 2 of HaalCentraal, this has changed: the goal binding (doelbinding) now determines which fields are returned. This results in a more concise dataset that contains only the necessary fields. Because each municipality (gemeente) can define its own unique goal bindings and corresponding fields, this plugin cannot include all possible mapping configurations by default.

```php
add_filter('pg::theme/dir_mapping_options', function ($value) {
return __DIR__ . '/templates/owc-prefill/';
}, 10, 1);
```
1 change: 0 additions & 1 deletion build/blocks.asset.php

This file was deleted.

1 change: 0 additions & 1 deletion build/blocks.js

This file was deleted.

1 change: 1 addition & 0 deletions build/icons-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/icons.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return ['dependencies' => [], 'version' => '12341f29470476729a0c'];
<?php return ['dependencies' => [], 'version' => 'eafbc2f5130762d2e52d'];
15 changes: 15 additions & 0 deletions build/personal-data-table/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "owc-prefill-gravity-forms/personal-data-table",
"version": "0.1.0",
"title": "Profielpagina",
"icon": "list-view",
"description": "Maak een profielpagina met persoonsgegevens van de ingelogde gebruiker.",
"example": {},
"supports": {
"html": false
},
"textdomain": "prefill-gravity-forms",
"editorScript": "file:./index.js"
}
1 change: 1 addition & 0 deletions build/personal-data-table/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks'], 'version' => '743c996e1df71c631ae5'];
1 change: 1 addition & 0 deletions build/personal-data-table/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions build/personal-data-table/personal-data-row/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "owc-prefill-gravity-forms/personal-data-row",
"version": "0.1.0",
"title": "Persoonsgegevens",
"icon": "id",
"description": "Toon persoonsgegevens van de ingelogde gebruiker.",
"example": {},
"supports": {
"html": false
},
"attributes": {
"selectedSupplier": {
"type": "object",
"default": {
"value": "",
"label": ""
}
},
"goalBinding": {
"type": "string",
"default": ""
},
"processing": {
"type": "string",
"default": ""
},
"selectedOption": {
"type": "object",
"default": {
"value": "",
"label": ""
}
},
"isChildOfTable": {
"type": "boolean",
"default": false
},
"htmlElement": {
"type": "string",
"default": "p"
}
},
"textdomain": "prefill-gravity-forms",
"editorScript": "file:./index.js",
"render": "file:./render.php"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => '581e0c58080f4f89a7ad'];
Loading