|
diff --git a/modules/oe_webtools_cookie_consent/config/install/oe_webtools_cookie_consent.settings.yml b/modules/oe_webtools_cookie_consent/config/install/oe_webtools_cookie_consent.settings.yml |
|
index df2b05a..213801f 100644 |
|
--- a/modules/oe_webtools_cookie_consent/config/install/oe_webtools_cookie_consent.settings.yml |
|
+++ b/modules/oe_webtools_cookie_consent/config/install/oe_webtools_cookie_consent.settings.yml |
|
@@ -1,2 +1,4 @@ |
|
banner_popup: true |
|
video_popup: true |
|
+cookie_notice_url: '' |
|
+langcode: en |
|
diff --git a/modules/oe_webtools_cookie_consent/config/schema/oe_webtools_cookie_consent.schema.yml b/modules/oe_webtools_cookie_consent/config/schema/oe_webtools_cookie_consent.schema.yml |
|
index 154867e..96a0cbd 100644 |
|
--- a/modules/oe_webtools_cookie_consent/config/schema/oe_webtools_cookie_consent.schema.yml |
|
+++ b/modules/oe_webtools_cookie_consent/config/schema/oe_webtools_cookie_consent.schema.yml |
|
@@ -10,3 +10,8 @@ oe_webtools_cookie_consent.settings: |
|
type: boolean |
|
label: 'CCK banner' |
|
description: 'Enable CCK video banner for the supported video elements.' |
|
+ cookie_notice_url: |
|
+ # We use label so it gets exposed to the config translation form. |
|
+ type: label |
|
+ label: 'Cookie Notice Page URL' |
|
+ description: 'A custom URL for the cookie notice page.' |
|
diff --git a/modules/oe_webtools_cookie_consent/oe_webtools_cookie_consent.module b/modules/oe_webtools_cookie_consent/oe_webtools_cookie_consent.module |
|
index cbdcf38..402af2a 100644 |
|
--- a/modules/oe_webtools_cookie_consent/oe_webtools_cookie_consent.module |
|
+++ b/modules/oe_webtools_cookie_consent/oe_webtools_cookie_consent.module |
|
@@ -13,6 +13,7 @@ use Drupal\Core\Url; |
|
use Drupal\media\IFrameMarkup; |
|
use Drupal\oe_webtools_cookie_consent\Event\ConfigBannerPopupEvent; |
|
use Drupal\oe_webtools_cookie_consent\Event\ConfigVideoPopupEvent; |
|
+use Drupal\oe_webtools_cookie_consent\Form\WebtoolsCookieConsentSettingsForm; |
|
|
|
define('OE_WEBTOOLS_COOKIE_CONSENT_EMBED_COOKIE_URL', '//europa.eu/webtools/crs/iframe/'); |
|
|
|
@@ -31,12 +32,18 @@ function oe_webtools_cookie_consent_page_attachments(array &$attachments) { |
|
$cache->applyTo($attachments); |
|
if ($event->isBannerPopup()) { |
|
$attachments['#attached']['library'][] = 'oe_webtools/drupal.webtools-smartloader'; |
|
+ $script_values = [ |
|
+ 'utility' => 'cck', |
|
+ ]; |
|
+ |
|
+ $url = \Drupal::config(WebtoolsCookieConsentSettingsForm::CONFIG_NAME)->get('cookie_notice_url'); |
|
+ if ($url) { |
|
+ $script_values['url'] = $url; |
|
+ } |
|
$cck_attachment = [ |
|
'#type' => 'html_tag', |
|
'#tag' => 'script', |
|
- '#value' => Json::encode([ |
|
- 'utility' => 'cck', |
|
- ]), |
|
+ '#value' => Json::encode($script_values), |
|
'#attributes' => ['type' => 'application/json'], |
|
]; |
|
|
|
diff --git a/modules/oe_webtools_cookie_consent/src/Form/WebtoolsCookieConsentSettingsForm.php b/modules/oe_webtools_cookie_consent/src/Form/WebtoolsCookieConsentSettingsForm.php |
|
index 35aa0e5..2a6d097 100644 |
|
--- a/modules/oe_webtools_cookie_consent/src/Form/WebtoolsCookieConsentSettingsForm.php |
|
+++ b/modules/oe_webtools_cookie_consent/src/Form/WebtoolsCookieConsentSettingsForm.php |
|
@@ -42,6 +42,13 @@ class WebtoolsCookieConsentSettingsForm extends ConfigFormBase { |
|
'#description' => $this->t('If checked, CCK will alter the URL to go through the EC Cookie Consent service.'), |
|
]; |
|
|
|
+ $form['cookie_notice_url'] = [ |
|
+ '#type' => 'textfield', |
|
+ '#title' => $this->t('Cookie Notice Page URL'), |
|
+ '#default_value' => $this->config(static::CONFIG_NAME)->get('cookie_notice_url'), |
|
+ '#description' => $this->t('The URL to the cookie notice page. The "{lang}" part of the URL will be automatically replaced by Webtools with the current language.'), |
|
+ ]; |
|
+ |
|
return parent::buildForm($form, $form_state); |
|
} |
|
|
|
@@ -52,6 +59,7 @@ class WebtoolsCookieConsentSettingsForm extends ConfigFormBase { |
|
$this->config(static::CONFIG_NAME) |
|
->set('banner_popup', $form_state->getValue('banner_popup')) |
|
->set('video_popup', $form_state->getValue('video_popup')) |
|
+ ->set('cookie_notice_url', $form_state->getValue('cookie_notice_url')) |
|
->save(); |
|
parent::submitForm($form, $form_state); |
|
} |