-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1220 from danskernesdigitalebibliotek/DDFLSBP-651…
…-implement-cookie-blocking-placeholder DDFLSBP-651 - Implement cookie blocking placeholder
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
web/themes/custom/novel/templates/fields/field--media--video.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |