沙尘暴/Neos-CookieConsent

该软件包已被废弃,不再维护。未建议替代软件包。
该软件包的最新版本(0.2.1)没有可用的许可信息。

安装次数: 6,996

依赖项: 0

建议者: 0

安全: 0

星级: 6

关注者: 8

分支: 1

公开问题: 1

类型:neos-package

0.2.1 2020-05-27 13:59 UTC

README

本软件包已停止维护

您应该查看我们的CookiePunch 软件包

本软件包可以帮助您创建比大多数其他软件包更细致的cookie同意。

  • 可由集成商配置
  • 弹出窗口的所有文本元素都可以通过您网站的编辑器进行自定义(对于集成商通过后端 UI 向 Neos 编辑器公开的部分)
  • 多语言兼容(自动翻译模态中的所有标签,并通过 Neos 内容维度自定义文本)
  • 易于扩展 -> 应用程序可以作为节点类型简单添加和配置

目录

兼容性和维护

该软件包目前正在为 Neos 4.3 LTS 进行维护。它是稳定的,我们在我们的项目中使用它。

Neos / Flow 版本 Sandstorm.CookieConsent 版本 维护
Neos 4.3 LTS, Flow 5.3 LTS 1.x

快速入门

1. 添加您自己的派生节点类型。

在这里我们决定将隐私政策的链接放置在 CookieConsent 节点类型的检查器中。我们还指定了它将出现的标签和组。

'Vendor.Site:CookieConsent':
  superTypes:
    'Sandstorm.CookieConsent:CookieConsent': true
  ui:
    inspector:
      tabs:
        general:
          label: Einstellungen
          position: 1
          icon: icon-pencil
      groups:
        settingsPrivacyPolicy:
          label: Datenschutzerklärung
          tab: general
          icon: ellipsis-h
          collapsed: true
  properties:
    privacyPolicyHref:
      type: string
      ui:
        label: Verlinkte Datenschutzseite
        inspector:
          group: settingsPrivacyPolicy
          editor: Neos.Neos/Inspector/Editors/LinkEditor

2. 将节点类型添加到您的页面上的某个位置

例如作为子节点

'Vendor.Site:RootPage':
  superTypes:
    'Neos.Neos:Document': true
  childNodes:
    cookie-consent:
      type: 'Vendor.Site:CookieConsent'
      ui:
        label: Cookie Consent

3. 为您的节点类型添加渲染

此软件包为您提供了一个渲染组件,该组件负责加载所需的javascript和css。它还配置了库,以便它知道需要用户同意的任何应用程序。

您的 fusion 组件作为集成组件,Sandstorm.CookieConsent:Component.CookieConsent 是表示组件。

简化示例

prototype(Vendor.Site:CookieConsent) < prototype(Neos.Fusion:Component) {
    _privacyPolicyHref = /* TODO */
    _privacyPolicyHref.@process.convert = Neos.Neos:ConvertUris
    
    _cookieModalTranslations = /* TODO */
    _language = /* TODO */
    _apps = /* TODO */

    renderer = Sandstorm.CookieConsent:Component.CookieConsent {
        privacyPolicyHref = ${props._privacyPolicyHref}
        cookieModalTranslations = ${props._cookieModalTranslations}
        language = ${props._language}
        apps = ${props._apps}
        includeLibraryCss = true
    }
}

4. 设置隐私政策链接

在这个例子中,我们决定让编辑在Neos检查器中更改隐私政策链接。

示例假设您将其直接放置在根页面(=站点节点)下方。请确保根据节点放置的位置调整节点路径。

prototype(Vendor.Site:CookieConsent) < prototype(Neos.Fusion:Component) {
    _privacyPolicyHref = ${q(site).find('cookie-consent').get(0).properties.privacyPolicyHref}
    _privacyPolicyHref.@process.convert = Neos.Neos:ConvertUris

    _cookieModalTranslations = /* TODO */
    _apps = /* TODO */
    _language = /* TODO */

    renderer = Sandstorm.CookieConsent:Component.CookieConsent {
        privacyPolicyHref = ${props._privacyPolicyHref}
        cookieModalTranslations = ${props._cookieModalTranslations}
        language = ${props._language}
        apps = ${props._apps}
        includeLibraryCss = true
    }
}

5. 翻译模态框(可选)

可以翻译cookie同意。它为许多语言提供了合理的默认值,并会自动尝试确定您页面的语言(例如,通过查看您的<html lang>属性。有关可用翻译,请参阅GitHub仓库

请注意融合键_cookieModalTranslations。它从我们在第1步中定义的CookieConsent节点类型中读取更多属性。以下将添加一个示例。您也可以提供静态字符串,并允许编辑在Neos后端检查器中更改键 - 这取决于您。在这里,编辑应提供自己的文本。

prototype(Vendor.Site:CookieConsent) < prototype(Neos.Fusion:Component) {
    @context._cookieConsentProps = ${q(site).find('cookie-consent').get(0).properties}

    _privacyPolicyHref = ${_cookieConsentProps.privacyPolicyHref}
    _privacyPolicyHref.@process.convert = Neos.Neos:ConvertUris

    _cookieModalTranslations = Neos.Fusion:DataStructure {
        ok = ${_cookieConsentProps.ok}
        decline = ${_cookieConsentProps.decline}
        consentNotice = Neos.Fusion:DataStructure {
            description = ${_cookieConsentProps.consentNoticeDescription}
            learnMore = ${_cookieConsentProps.consentNoticeLearnMore}
        }
        consentModal = Neos.Fusion:DataStructure {
            title = ${_cookieConsentProps.consentModalTitle}
            description = ${_cookieConsentProps.consentModalDescription}
            privacyPolicy = Neos.Fusion:DataStructure {
                name = ${_cookieConsentProps.consentModalPrivacyPolicyName}
                text = ${_cookieConsentProps.consentModalPrivacyPolicyText}
            }
        }
        # Static labels, will not be translated. Hopefully generic enough to be used in any language
        purposes = Neos.Fusion:DataStructure {
            livechat = 'Live Chat'
            styling = 'Styling'
            tracking = 'Tracking'
        }
    }

    _apps = /* TODO */
    _language = /* TODO */

    renderer = Sandstorm.CookieConsent:Component.CookieConsent {
        privacyPolicyHref = ${props._privacyPolicyHref}
        cookieModalTranslations = ${props._cookieModalTranslations}
        language = ${props._language}
        apps = ${props._apps}
        includeLibraryCss = true
    }
}
'Vendor.Site:CookieConsent':
  superTypes:
    'Sandstorm.CookieConsent:CookieConsent': true
  ui: 
    inspector:
      groups:
        smallPopup:
          label: Kleines Popup
          tab: general
          icon: icon-pencil
          position: 100
          collapsed: true
      /* ... */
  properties:
    ok:
      type: string
      defaultValue: Alle Cookies zulassen
      ui:
        label: Cookies-Zulassen Button
        inspector:
          group: smallPopup
  /* Add all translations that should be translated by the editor ... */

要找出您可以翻译的内容,最简单的方法是将cookieConsent的语言更改为不存在的语言,例如“foo”(见以下组件的渲染器,那里语言键作为属性传递)。在前端,它将无法加载翻译并告诉您它查找翻译的路径。

6. 添加需要用户同意的应用

该软件包附带一些应用(例如Google Analytics),它们已经预配置了需要同意的责任,您可以直接从Neos后端将其添加到CookieConsent节点下面的应用集合中。

如果您需要尚未包含的应用,只需复制现有的节点类型之一,并填写必要的信息。

请打开一个包含您应用配置的pull request或问题,以便其他人也能从中受益 :)

prototype(Vendor.Site:CookieConsent) < prototype(Neos.Fusion:Component) {
    @context._cookieConsentProps = /* Previous example */

    _privacyPolicyHref = /* Previous example */
    _cookieModalTranslations = /* Previous example */

    _apps = ${q(site).find('cookie-consent/apps').children().get()}

    _language = /* TODO */

    renderer = Sandstorm.CookieConsent:Component.CookieConsent {
        privacyPolicyHref = ${props._privacyPolicyHref}
        cookieModalTranslations = ${props._cookieModalTranslations}
        language = ${props._language}
        apps = ${props._apps}
        includeLibraryCss = true
    }
}

7. 在您的标记中放置新的组件

在您的页面上某个位置渲染您的新组件。

body.some.fusion.path.cookieConsent = Vendor.Site:CookieConsent

8. 放置Cookie-Manager按钮

为了允许您的用户重新访问他们的cookie设置,您需要在您的网站上放置一个特殊按钮组件。我们已提供相应的节点类型及其融合组件。只需在您的内容集合配置中允许'Sandstorm.CookieConsent:OpenCookieManagerButton': true,并将组件添加到您的网站(最好在您的数据政策页面上)。

定制

待办事项

1. 定制内容

2. 定制内容

下一步/可能进一步开发

许可&版权

MIT许可,(c) Sandstorm Media GmbH 2020