Skip to content

Commit 88a17a5

Browse files
committed
!!!TASK: use Klaro v0.7.3, breaking configuration changes, improve content placeholder UX
1 parent 5b8d86a commit 88a17a5

32 files changed

+1280
-1784
lines changed

Classes/Eel/Helper/KlaroHelper.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
class KlaroHelper implements ProtectedContextAwareInterface
88
{
99
/**
10-
* Build apps config
10+
* Build services config
1111
*
1212
* @param array $apps
1313
* @return array
1414
*/
15-
public function buildAppsConfig(array $apps) {
15+
public function buildServicesConfig(array $services) {
1616

1717
// Remove disabled apps and set default position
18-
$appsConfig = [];
19-
foreach ($apps as $appName => $appSettings) {
20-
if (isset($appSettings['enabled']) && $appSettings['enabled'] === true) {
21-
$appSettings['klaro']['position'] = isset($appSettings['position']) ? $appSettings['position'] : 0;
22-
$appsConfig[] = $appSettings['klaro'];
18+
$servicesConfig = [];
19+
foreach ($services as $serviceName => $serviceSettings) {
20+
if (isset($serviceSettings['enabled']) && $serviceSettings['enabled'] === true) {
21+
$serviceSettings['klaro']['position'] = isset($serviceSettings['position']) ? $serviceSettings['position'] : 0;
22+
$servicesConfig[] = $serviceSettings['klaro'];
2323
}
2424
}
2525

2626
// Sort by position key
27-
usort($appsConfig, function ($app1, $app2) {
28-
return $app1['position'] <=> $app2['position'];
27+
usort($servicesConfig, function ($service1, $service2) {
28+
return $service1['position'] <=> $service2['position'];
2929
});
3030

31-
return $appsConfig;
31+
return $servicesConfig;
3232
}
3333

3434
/**

Configuration/Settings.Consent.Cloudflare.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Tms:
1010
cloudflare:
1111
description: 'Protects us from attackers and helps to distribute our content quickly worldwide.'
1212

13-
apps:
13+
services:
1414
cloudflare:
1515
enabled: false
1616

Configuration/Settings.Consent.GoogleAnalytics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Tms:
1010
googleAnalytics:
1111
description: 'Allows us to analyse website usage anonymously (e.g. pageviews, channels, devices, screen resolutions, etc.)'
1212

13-
apps:
13+
services:
1414
googleAnalytics:
1515
enabled: false
1616

Configuration/Settings.Consent.GoogleMaps.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Tms:
1010
googleMaps:
1111
description: 'Allow embedded Google Maps on this site'
1212

13-
apps:
13+
services:
1414
googleMaps:
1515
enabled: false
1616

@@ -21,5 +21,5 @@ Tms:
2121
name: googleMaps
2222
default: false
2323
title: 'Google Maps'
24-
purposes: ['functionality']
24+
purposes: ['content']
2525
callback: toggleNoConsentPlaceholders

Configuration/Settings.Consent.Matomo.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Tms:
44
translations:
55
de:
66
matomo:
7-
description: 'Ermöglicht uns eine anonymisierte Auswertung der Website Nutzung (z.B. Seitenaufrufe, Kanäle, Endgeräte, Bildschirmauflösungen, etc.)'
7+
description: 'Ermöglicht uns eine Auswertung der Website Nutzung (z.B. Seitenaufrufe, Kanäle, Endgeräte, Bildschirmauflösungen, etc.)'
88

99
en:
1010
matomo:
11-
description: 'Allows us to analyse website usage anonymously (e.g. pageviews, channels, devices, screen resolutions, etc.)'
11+
description: 'Allows us to analyse website usage (e.g. pageviews, channels, devices, screen resolutions, etc.)'
1212

13-
apps:
13+
services:
1414
matomo:
1515
# Each app must include the 'enabled' key and should be disabled
1616
# by default within this package
@@ -22,9 +22,9 @@ Tms:
2222
klaro:
2323
name: matomo
2424

25-
# If "default" is set to true, the app will be enabled by default
25+
# If "default" is set to true, the service will be enabled by default
2626
# Overwrites global "default" setting.
27-
# We recommend leaving this to "false" for apps that collect
27+
# We recommend leaving this to "false" for services that collect
2828
# personal information.
2929
default: false
3030

@@ -40,7 +40,7 @@ Tms:
4040
# given app, Klaro will then automatically delete all matching
4141
# cookies.
4242
# You can also explicitly provide a path and a domain for
43-
# a given cookie. This is necessary if you have apps that
43+
# a given cookie. This is necessary if you have services that
4444
# set cookies for a path that is not "/" or a domain that
4545
# is not the current domain. If you do not set these values
4646
# properly, the cookie can't be deleted by Klaro

Configuration/Settings.Consent.Youtube.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Tms:
1010
youtube:
1111
description: 'Allow embedded Youtube videos on this site'
1212

13-
apps:
13+
services:
1414
youtube:
1515
enabled: false
1616

@@ -21,5 +21,5 @@ Tms:
2121
name: youtube
2222
default: false
2323
title: 'Youtube'
24-
purposes: ['functionality']
24+
purposes: ['content']
2525
callback: toggleNoConsentPlaceholders

Configuration/Settings.Translations.De.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@ Tms:
33
config:
44
translations:
55
de:
6+
# See default DE translation - https://github.com/kiprotect/klaro/blob/master/src/translations/de.yml
67
consentNotice:
78
learnMore: 'Anpassen'
89

9-
acceptAll: 'Alle Anwendungen akzeptieren'
10+
decline: 'Ablehnen'
11+
ok: 'Alle Dienste akzeptieren'
1012
acceptSelected: 'Auswahl speichern'
1113

1214
purposes:
13-
performance: 'Sicherheit & Performance'
14-
functionality: 'Funktionalität'
15-
analytics: 'Webstatistik'
16-
targeting: 'Anzeigen von Werbung'
15+
performance:
16+
title: 'Sicherheit und Performance'
17+
description: ''
18+
functionality:
19+
title: 'Funktionalität'
20+
description: ''
21+
content:
22+
title: 'Externe Inhalte'
23+
description: ''
24+
analytics:
25+
title: 'Webanalyse'
26+
description: ''
27+
marketing:
28+
title: 'Marketing'
29+
description: ''

Configuration/Settings.Translations.En.yaml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,31 @@ Tms:
33
config:
44
translations:
55
en:
6+
# See default EN translation - https://github.com/kiprotect/klaro/blob/master/src/translations/en.yml
67
consentNotice:
78
learnMore: 'Customize'
89

9-
acceptAll: 'Accept all applications'
10+
decline: 'Decline'
11+
ok: 'Accept all services'
1012
acceptSelected: 'Accept selected'
1113

14+
service:
15+
purpose: Purpose
16+
purposes: Purposes
17+
1218
purposes:
13-
performance: 'Security & Performance'
14-
functionality: 'Functionality'
15-
analytics: 'Analytics'
16-
targeting: 'Targeting and Advertising'
19+
performance:
20+
title: 'Security and Performance'
21+
description: ''
22+
functionality:
23+
title: 'Functionality'
24+
description: ''
25+
content:
26+
title: 'External Content'
27+
description: ''
28+
analytics:
29+
title: 'Analytics'
30+
description: ''
31+
marketing:
32+
title: 'Marketing'
33+
description: ''

Configuration/Settings.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Tms:
1111
Consent:
1212
enabled: true
1313

14+
# Disable includes if you use your own or want to add them to your favorite build tool
1415
autoInclude:
1516
config: true
1617
scripts: true
1718
styles: true
1819

20+
1921
enableStickyConsentSettingsButton: true
2022

2123
config:
@@ -26,8 +28,8 @@ Tms:
2628
privacyPolicy: ''
2729

2830
# Find all general translations in setting files, separated by language - see 'Settings.Translations.De.yaml'
29-
# App related translations should be within each app setting file - see 'Settings.Apps.Matomo.yaml'
31+
# App related translations should be within each app setting file - see 'Settings.Consent.Matomo.yaml'
3032
translations: []
3133

32-
# Find individual app configurations in separated setting files
33-
apps: []
34+
# Find individual service configurations in separated setting files
35+
services: []

README.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Let your users decide, which scripts should be loaded and executed while visitin
66

77
---
88

9-
**!!! This is currently experimental code, please do not rely on any parts yet.**
10-
119
**IMPORTANT: We are developers, no lawyers. Using this package without further adaptation will most likely NOT result in GDPR, ePrivacy nor CCPA compliance!**
1210

1311
---
@@ -18,11 +16,20 @@ Let your users decide, which scripts should be loaded and executed while visitin
1816
composer require tms/consent
1917
```
2018

19+
## What's included?
20+
21+
* Klaro Script + opinionated Klaro Config (override or use your own anytime)
22+
* Klaro Config editing via `Settings.yaml` & predefined services
23+
* Klaro default styles & themes [`/Resources/Private/Styles/Theme`](https://github.com/tmsdev/Tms.Consent/tree/master/Resources/Private/Styles/Theme)
24+
* Placeholder for blocked content elements (Fusion Component + JS)
25+
* Consent settings button (Fusion Component + JS)
26+
* Overrides for common Neos packages [`/Resources/Private/Fusion/PresetPackages`](https://github.com/tmsdev/Tms.Consent/tree/master/Resources/Private/Fusion/PresetPackages)
27+
2128
## Usage
2229

23-
### Step 1: App configuration via `YAML` settings
30+
### Step 1: Service configuration via `YAML` settings
2431

25-
This package includes default consent management settings for these apps
32+
This package includes default consent management settings for the following services. Enable them in your `Settings.yaml` or add your own services.
2633

2734
* Cloudflare
2835
* Matomo
@@ -31,74 +38,72 @@ This package includes default consent management settings for these apps
3138
* Youtube
3239

3340
```yaml
34-
# Example configuration
41+
# Example Tms.Consent configuration
3542
Tms:
3643
Consent:
3744
config:
3845
# The privacy policy uri can be specified by node type, path, identifier or simply an absolute/relative link
3946
privacyPolicy: '#4999814e-61c2-4ce1-ab46-c1145f2285d7'
4047

41-
# Enable the apps you need consent management for
42-
apps:
48+
# Enable the services you need consent management for
49+
services:
4350
matomo:
4451
enabled: true
52+
# Use the position key to render services in your favorite order
53+
position: 100
4554
youtube:
4655
enabled: true
56+
position: 200
4757
```
4858
49-
#### Extend your apps
59+
#### Extend your services
5060
5161
Simply extend the `YAML` settings within your Neos package.
5262

5363
```yaml
5464
Tms:
5565
Consent:
5666
config:
57-
apps:
58-
yourAppName:
67+
services:
68+
yourServiceName:
5969
enabled: true
6070
6171
# -----------------------------------------------------------------
6272
# Klaro! Config
6373
# -----------------------------------------------------------------
6474
klaro:
65-
name: yourAppName
66-
title: 'Your App Title'
67-
description: 'Short description, why your website use the app...'
75+
name: yourServiceName
76+
title: 'Your Service Title'
77+
description: 'Short description, why your website use this service...'
6878
purposes: ['functionality']
6979
```
7080

71-
Think your app configuration is useful for others too?
72-
Don't hesitate to submit a PR. All the app related configuration should be combined in one settings
73-
file named like `Settings.Consent.YourAppName.yaml`.
81+
Think your service configuration is useful for others too?
82+
Don't hesitate to submit a PR. All the service related configuration should be combined in one settings
83+
file named like `Settings.Consent.YourServiceName.yaml`.
7484

7585
### Step 2: Modify HTML
7686

77-
In order to control your configured apps (e.g. to stop loading and/or execution without consent) it is necessary to
87+
In order to control your configured services (e.g. to stop loading and/or execution without consent) it is necessary to
7888
modify the resulting HTML of your webpages.
7989

8090
This can be achieved by simply replacing some attributes - see https://github.com/KIProtect/klaro#managing-third-party-appstrackers
8191

8292
We try to provide preconfigured solutions for some common Neos packages, please have a look at [`/Resources/Private/Fusion/PresetPackages`](https://github.com/tmsdev/Tms.Consent/tree/master/Resources/Private/Fusion/PresetPackages)
83-
what we've already covered. Your package is missing? Submit a PR, if you think the app configuration could be useful for others.
93+
what we've already covered. Your package is missing? Submit a PR, if you think the service configuration could be useful for others.
8494

8595
### Step 3: Verify
8696

87-
Check your site - have you blocked all your critical apps?
97+
Check your site - have you blocked all your critical services?
8898

8999
* by using the dev tools of your favorite browser
90100
* or simply run a check on https://webbkoll.dataskydd.net/
91101

92102
## Wishlist
93103

94104
* Add multi-site support
95-
* Make it work with lazyloaded elements
96-
* Make apps sortable
97-
* Placeholder for blocked content elements (like Youtube, Maps, etc.)
98-
* Support more apps by default
99105
* Backend module with some basic statistics on acceptance rate
100106
* User location based configurations
101-
* Additional layouts & styles
102107

103108
Any feedback, pull request or other contribution is very welcome!
104109

0 commit comments

Comments
 (0)