druidfi/iframe_cookie_consent

添加 Ckeditor 插件,将 iframe 嵌入转换为支持 Cookie 许可

安装数量: 2,807

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 1

类型:drupal-module

1.3.2 2023-08-11 11:35 UTC

This package is auto-updated.

Last update: 2024-09-02 09:09:54 UTC


README

第三方内容提供者(如 YouTube)在 iframe 中加载的网站内容可能需要设置 Cookie,并因此需要访客的同意。

https://support.cookiebot.com/hc/en-us/articles/360003790854-Iframe-cookie-consent-with-YouTube-example

https://support.cookiebot.com/hc/en-us/articles/360003812053-Hide-and-show-content-based-on-the-visitor-s-consent

本模块功能

此模块添加了 Ckeditor 插件,可以将 YouTube iframe 嵌入转换为支持 Cookie 许可。您可以选择以下其中一个值作为 data-cookieconsent 属性: preferencesstatisticsmarketing

您可以在内容创建 / Iframe Cookie 许可下找到这些设置

/admin/config/content/iframe_cookie_consent

如何使用

前往配置 / 内容创建 / 文本格式和编辑器,并编辑您想使用 Iframe Cookie 许可模块的文本格式。

/admin/config/content/formats/

现在在已启用过滤器下,您将看到刚刚启用的 Iframe Cookie 许可

字段支持

YouTube 视频可以通过多种方式嵌入到内容中,因此支持字段的最简单方法是创建或修改字段模板文件。

以下是一个示例。

<iframe
  {{ attributes }}
  {% if url is not empty %}
    data-cookieblock-src={{ url }}
    data-cookieconsent="marketing"
    class=" cookieconsent-optin-marketing"

    {% if query is not empty %}
      ?{{ query | url_encode }}
    {% endif %}

    {% if fragment is not empty %}
      #{{ fragment }}
    {% endif %}"
  {% endif %}
  >
</iframe>
<div class="cookieconsent-optout-marketing">
   {{ 'Please <a href="javascript:Cookiebot.renew()">accept marketing-cookies</a> to watch this video'|t }}
</div>