Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDFLSBP-651 - Implement cookie blocking placeholder #1220

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion config/sync/cookieinformation.settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enable_popup: false
enable_popup: true
google_consent_mode: ''
block_iframes: false
block_iframes_category: functional
Expand Down
1 change: 1 addition & 0 deletions config/sync/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module:
dpl_breadcrumb: 0
dpl_cache_settings: 0
dpl_campaign: 0
dpl_cookies: 0
dpl_dashboard: 0
dpl_error_pages: 0
dpl_event: 0
Expand Down
7 changes: 7 additions & 0 deletions web/modules/custom/dpl_cookies/dpl_cookies.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "DPL Cookies"
type: module
description: "A module that handles cookie functionality."
package: DPL
core_version_requirement: ^10
dependencies:
- cookieinformation:cookieinformation
21 changes: 21 additions & 0 deletions web/modules/custom/dpl_cookies/dpl_cookies.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @file
* DPL cookies module.
*/

/**
* Implements hook_preprocess_media().
*
* Adds cookie consent attributes to media video fields.
*/
function dpl_cookies_preprocess_field__media__video(array &$variables): void {
foreach ($variables['items'] as &$item) {
if (isset($item['content']['#attributes']['src'])) {
$item['content']['#attributes']['data-once'] = 'cookieinformation-iframe';
$item['content']['#attributes']['data-category-consent'] = 'cookie_cat_marketing';
$item['content']['#attributes']['data-consent-src'] = $item['content']['#attributes']['src'];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% for item in items %}
{{ item.content }}
{% endfor %}

<div class="consent-placeholder cookie-placeholder cookie-placeholder__hide" data-category="cookie_cat_marketing">
<div class="pagefold-triangle--medium pagefold-inherit-parent"></div>
<div class="cookie-placeholder__wrapper">
<div class="cookie-placeholder__description">
<div id="dpl-react-apps-cookie-placeholder">
{{ "To view this content, we need your consent to use marketing cookies."|t({}, {"context": "Cookie Placeholder"}) }}
</div>
</div>
<button
type="button"
class="cookie-placeholder__manage-consent-button btn-primary btn-outline btn-xlarge arrow__hover--right-small"
aria-label="{{ 'Manage consent'|t({}, {'context': 'Cookie Placeholder'}) }}"
onClick="javascript:CookieConsent.renew();"
>
{{ "Manage consent"|t({}, {"context": "Cookie Placeholder"}) }}
</button>
</div>
</div>
Loading