diff --git a/config/install/iubenda_integration.settings.yml b/config/install/iubenda_integration.settings.yml
index b72a7a5..45698db 100644
--- a/config/install/iubenda_integration.settings.yml
+++ b/config/install/iubenda_integration.settings.yml
@@ -1,24 +1,30 @@
-iubenda_integration_policy_code: ''
+iubenda_integration_policy_code:
iubenda_integration_style: iubenda-nostyle
iubenda_integration_legal_only: false
iubenda_integration_show_brand: true
iubenda_integration_form_element_type: checkbox
iubenda_integration_forms: ''
+iubenda_integration_form_element_label: 'Yes'
iubenda_integration_pretext: 'I have read and understood the'
+iubenda_integration_text: 'Privacy Policy'
iubenda_integration_posttext: ''
-iubenda_integration_block_pretext: ''
-iubenda_integration_block_posttext: ''
iubenda_integration_cookie_policy_enabled: false
-iubenda_integration_text: 'Privacy Policy'
-consentOnScroll: true
-localConsentPath: '/'
+localConsentPath: /
slideDown: true
applyStyles: true
skipSaveConsent: false
logViaAlert: false
-langcode: en
-acceptButtonDisplay: false
-customizeButtonDisplay: false
-rejectButtonDisplay: false
-closeButtonDisplay: true
-closeButtonRejects: false
+iubenda_integration_block_pretext: ''
+iubenda_integration_block_posttext: ''
+acceptButtonDisplay: 1
+customizeButtonDisplay: 0
+rejectButtonDisplay: 1
+closeButtonDisplay: 1
+closeButtonRejects: 0
+siteId: ''
+enableGdpr: 1
+enableLgpd: 1
+enableFadp: 1
+enableUspr: 1
+position: full-top
+backgroundOverlay: 0
diff --git a/config/schema/iubenda_integration.schema.yml b/config/schema/iubenda_integration.schema.yml
index 6b65250..5e19da1 100644
--- a/config/schema/iubenda_integration.schema.yml
+++ b/config/schema/iubenda_integration.schema.yml
@@ -18,25 +18,19 @@ iubenda_integration.settings:
iubenda_integration_form_element_label:
type: label
label: 'Label text'
- weight: 1
iubenda_integration_pretext:
type: text
label: 'Link prefix'
- weight: 2
iubenda_integration_text:
type: label
label: 'Link text'
- weight: 3
iubenda_integration_posttext:
type: text
label: 'Link suffix'
- weight: 4
iubenda_integration_cookie_policy_enabled:
type: boolean
localConsentPath:
type: string
- consentOnScroll:
- type: boolean
slideDown:
type: boolean
applyStyles:
@@ -45,9 +39,41 @@ iubenda_integration.settings:
type: boolean
logViaAlert:
type: boolean
+ iubenda_integration_block_pretext:
+ type: text
+ label: 'Block prefix text'
+ iubenda_integration_block_posttext:
+ type: text
+ label: 'Block suffix text'
cookiePolicyId:
type: label
label: 'Cookie Policy ID'
cookiePolicyUrl:
type: label
label: 'Cookie Policy URL'
+ acceptButtonDisplay:
+ type: boolean
+ customizeButtonDisplay:
+ type: boolean
+ rejectButtonDisplay:
+ type: boolean
+ closeButtonDisplay:
+ type: boolean
+ closeButtonRejects:
+ type: boolean
+ siteId:
+ type: label
+ label: 'Site ID'
+ enableGdpr:
+ type: boolean
+ enableLgpd:
+ type: boolean
+ enableFadp:
+ type: boolean
+ enableUspr:
+ type: boolean
+ position:
+ type: string
+ backgroundOverlay:
+ type: boolean
+
diff --git a/iubenda_integration.libraries.yml b/iubenda_integration.libraries.yml
index d8c47f1..73b2973 100644
--- a/iubenda_integration.libraries.yml
+++ b/iubenda_integration.libraries.yml
@@ -7,7 +7,7 @@ cookie-solution:
version: 2.0
js:
js/cookie-solution-settings.js: {}
- https://cdn.iubenda.com/cs/tcf/stub-v2.js: { type: external, attributes: { type: text/javascript }}
+ https://cdn.iubenda.com/cs/gpp/stub.js: { type: external, attributes: { type: text/javascript }}
https://cdn.iubenda.com/cs/iubenda_cs.js: { type: external, attributes: { type: text/javascript, charset: UTF-8, async: true }}
dependencies:
- core/drupalSettings
diff --git a/iubenda_integration.module b/iubenda_integration.module
index d1b9f08..8897bb3 100644
--- a/iubenda_integration.module
+++ b/iubenda_integration.module
@@ -175,50 +175,47 @@ function iubenda_integration_page_attachments(array &$attachments) {
// Attach JS when privacy policy ID is filled.
// Setting page: admin/config/system/iubenda-integration.
$policy_code = $config->get('iubenda_integration_policy_code');
- if (!empty($policy_code)) {
+ $cookie_solution_enable = $config->get('cookie_solution_enable');
+ if ($cookie_solution_enable && !empty($policy_code)) {
// Attach iubenda js library.
$attachments['#attached']['library'][] = 'iubenda_integration/privacy-policy';
// Attach JS when cookie policy is enabled.
// Setting page: admin/config/system/iubenda-integration/cookie-policy.
if (!empty($config->get('siteId'))) {
-
- $consent_on_browsing = $config->get('consentOnContinuedBrowsing');
-
// Attach setting values that we need to enable cookie banner.
$iubenda_integration = [
'iubendaCookiePolicy' => [
- 'enableCMP' => TRUE,
- 'isTCFConsentGlobal' => FALSE,
- 'cookiePolicyId' => $policy_code,
- 'siteId' => $config->get('siteId'),
+ 'askConsentAtCookiePolicyUpdate' => TRUE,
+ 'countryDetection' => TRUE,
+ 'enableGdpr' => (bool) $config->get('enableGdpr'),
+ 'enableFadp' => (bool) $config->get('enableFadp'),
+ 'enableLgpd' => (bool) $config->get('enableLgpd'),
+ 'enableUspr' => (bool) $config->get('enableUspr'),
+ 'floatingPreferencesButtonDisplay' => 'bottom-right',
'lang' => \Drupal::languageManager()->getCurrentLanguage()->getId(),
- 'consentOnContinuedBrowsing' => $consent_on_browsing,
+ 'lgpdAppliesGlobally' => FALSE,
+ 'perPurposeConsent' => TRUE,
+ 'preferenceCookie' => [
+ 'expireAfter' => 180,
+ ],
+ 'siteId' => (int) $config->get('siteId'),
+ 'whitelabel' => FALSE,
+ 'cookiePolicyId' =>(int) $policy_code,
'banner' => [
+ 'acceptButtonDisplay' => (bool) $config->get('acceptButtonDisplay'),
+ 'backgroundOverlay' => (bool) $config->get('backgroundOverlay'),
+ 'closeButtonDisplay' => (bool) $config->get('closeButtonDisplay'),
+ 'closeButtonRejects' => (bool) $config->get('closeButtonRejects'),
+ 'customizeButtonDisplay' => (bool) $config->get('customizeButtonDisplay'),
'position' => $config->get('position'),
- 'backgroundOverlay' => $config->get('backgroundOverlay'),
- 'acceptButtonDisplay' => $config->get('acceptButtonDisplay'),
- 'customizeButtonDisplay' => $config->get('customizeButtonDisplay'),
- 'rejectButtonDisplay' => $config->get('rejectButtonDisplay'),
- 'closeButtonDisplay' => $config->get('closeButtonDisplay'),
- 'closeButtonRejects' => $config->get('closeButtonRejects'),
+ 'rejectButtonDisplay' => (bool) $config->get('rejectButtonDisplay'),
+ 'showTitle' => FALSE,
+ 'showTotalNumberOfProviders' => TRUE,
],
],
];
- // consentOnContinuedBrowsing (boolean, default true).
- // If set to false, consentOnScroll, consentOnDocument and
- // consentOnLinkAndButton are set to false, and consentOnElement is set
- // to no element. This way you only accept explicit consent, while
- // consent on scroll and page interaction is not given.
- if (!$consent_on_browsing) {
- $iubenda_integration['iubendaCookiePolicy']['consentOnScroll'] = FALSE;
- $iubenda_integration['iubendaCookiePolicy']['consentOnDocument'] = FALSE;
- $iubenda_integration['iubendaCookiePolicy']['consentOnLinkAndButton'] = FALSE;
- $iubenda_integration['iubendaCookiePolicy']['consentOnElement'] = NULL;
- $iubenda_integration['iubendaCookiePolicy']['consentOnScroll'] = FALSE;
- }
-
\Drupal::moduleHandler()->alter('iubenda_integration', $iubenda_integration);
$attachments['#attached']['drupalSettings']['iubendaIntegration'] = $iubenda_integration;
$attachments['#attached']['library'][] = 'iubenda_integration/cookie-solution-settings';
diff --git a/js/cookie-solution-settings.js b/js/cookie-solution-settings.js
index bec9151..32a660e 100644
--- a/js/cookie-solution-settings.js
+++ b/js/cookie-solution-settings.js
@@ -1,2 +1,2 @@
var _iub = _iub || [];
-_iub.csConfiguration = drupalSettings.iubendaIntegration.iubendaCookiePolicy;
\ No newline at end of file
+_iub.csConfiguration = drupalSettings.iubendaIntegration.iubendaCookiePolicy;
diff --git a/src/Form/IubendaSettingsCookieForm.php b/src/Form/IubendaSettingsCookieForm.php
index 9c28221..e82fdbb 100644
--- a/src/Form/IubendaSettingsCookieForm.php
+++ b/src/Form/IubendaSettingsCookieForm.php
@@ -61,8 +61,19 @@ class IubendaSettingsCookieForm extends ConfigFormBase {
$config = $this->config('iubenda_integration.settings');
+ $form['cookie_solution_enable'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Enable the cookie solution'),
+ '#default_value' => $config->get('cookie_solution_enable') ?? FALSE,
+ ];
+
$form['settings'] = [
'#type' => 'vertical_tabs',
+ '#states' => [
+ 'visible' => array(
+ ':input[name="cookie_solution_enable"]' => array('checked' => TRUE),
+ ),
+ ],
];
$form['cookie_solution_general'] = [
@@ -80,14 +91,45 @@ class IubendaSettingsCookieForm extends ConfigFormBase {
'#description' => $this->t('Your site identity code. You can find it
in your embed banner javascript code (ex. "siteId":XXXXXX).'),
];
- $form['cookie_solution_general']['consentOnContinuedBrowsing'] = [
- '#title' => $this->t('Consent on continued browsing'),
- '#description' => $this->t("If you're operating, for instance, in
- the UK, Ireland, France, Germany, Denmark, Belgium and Greece,
- consider that the respective national data protection authorities do not
- regard consent by continuing navigation as valid."),
+ $form['cookie_solution_general']['enableGdpr'] = [
+ '#title' => 'GDPR',
+ '#description' => $this->t('The General Data Protection Regulation (GDPR)
+ is a European data protection legislation. If the regulation is applicable
+ to you - because you are based in Europe, or you target users in Europe
+ - you must comply with its requirements. Discover more', ['@url' => 'https://www.iubenda.com/en/help/5428-gdpr-guide']),
+ '#type' => 'checkbox',
+ '#default_value' => $config->get('enableGdpr') ?? '1',
+ ];
+ $form['cookie_solution_general']['enableLgpd'] = [
+ '#title' => 'LGPD',
+ '#description' => $this->t('The Lei Geral de Proteção de Dados Pessoais (LGPD)
+ is the Brazilian data protection law aimed at enhancing Brazilian users’ privacy rights.
+ If LGPD is applicable to you — because you carry out operations in Brazil
+ (for example, because your company is based in Brazil or you use servers
+ based in the Brazilian territory), you target users in Brazil or you
+ process personal data of an individual that was located in Brazil at
+ the time of collection — you must comply with its requirements. Discover more', ['@url' => 'https://www.iubenda.com/en/help/26706-lgpd-guide']),
+ '#type' => 'checkbox',
+ '#default_value' => $config->get('enableLgpd') ?? '1',
+ ];
+ $form['cookie_solution_general']['enableFadp'] = [
+ '#title' => $this->t('Switzerland'),
+ '#description' => $this->t('If LGPD or GDPR legislations are applied globally,
+ they will override the Swiss data protection framework. Therefore,
+ a consent-based approach (i.e., trackers are not placed until the user
+ has given consent) rather than an opt-out approach will apply.'),
+ '#type' => 'checkbox',
+ '#default_value' => $config->get('enableFadp') ?? '1',
+ ];
+ $form['cookie_solution_general']['enableUspr'] = [
+ '#title' => $this->t('US State Laws'),
+ '#description' => $this->t('This option will help you comply with some
+ privacy laws across the United States (California, Virginia, Colorado,
+ Connecticut, Utah, Texas, Oregon and Montana). If you target users
+ residing in the US, you may be required to comply with the privacy laws
+ of the relevant US state.'),
'#type' => 'checkbox',
- '#default_value' => $config->get('consentOnContinuedBrowsing') ?? '1',
+ '#default_value' => $config->get('enableUspr') ?? '1',
];
$form['cookie_solution_general']['position'] = [
'#title' => $this->t('Banner position'),