diff --git a/Configuration/NodeTypes.Content.CookieBot.yaml b/Configuration/NodeTypes.Content.CookieBot.yaml new file mode 100644 index 0000000..1e967de --- /dev/null +++ b/Configuration/NodeTypes.Content.CookieBot.yaml @@ -0,0 +1,11 @@ +'Avency.Neos.CookieBot:Content.CookieBot': + superTypes: + 'Neos.Neos:Content': true + options: + fusion: + prototypeGenerator: ~ + ui: + group: 'modules-special' + label: i18n + icon: 'icon-question-circle' + position: 3090 diff --git a/Configuration/NodeTypes.Mixin.CookieBotKey.yaml b/Configuration/NodeTypes.Mixin.CookieBotKey.yaml new file mode 100644 index 0000000..ef00ff6 --- /dev/null +++ b/Configuration/NodeTypes.Mixin.CookieBotKey.yaml @@ -0,0 +1,11 @@ +'Avency.Neos.CookieBot:Mixin.CookieBotKey': + abstract: true + properties: + cookieBotKey: + type: string + defaultValue: '' + ui: + label: i18n + inspector: + group: 'document' + position: 'end' diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml new file mode 100644 index 0000000..95e7555 --- /dev/null +++ b/Configuration/Settings.yaml @@ -0,0 +1,16 @@ +# Enter CookieBot key here if you don't use the mixin +# +#Avency: +# Neos: +# CookieBot: +# key: '' +Neos: + Neos: + fusion: + autoInclude: + 'Avency.Neos.CookieBot': true + userInterface: + translation: + autoInclude: + 'Avency.Neos.CookieBot': + - 'NodeTypes/*' diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..d3b3be3 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 avency GmbH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8fd8e29 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Avency.Neos.CookieBot + +> A package to integrate [Cookiebot](https://www.cookiebot.com/) into Neos. + +## Authors & Sponsors + +Benjamin Kentsch - benjamin.kentsch@avency.de +Michael Gerdemann - michael.gerdemann@avency.de + +The development and the public-releases of this package is generously sponsored by our employer https://www.avency.de. + +## Installation + +``` +composer require avency/neos-cookiebot +``` + +## Configuration + +Configure the key in Settings.yaml: + +``` +Avency: + Neos: + CookieBot: + key: '' +``` + +Or add the mixin to your root page: + +``` + superTypes: + 'Avency.Neos.CookieBot:Mixin.CookieBotKey': true +``` +## License + +The MIT License (MIT). Please see [License File](./LICENSE.md) for more information. diff --git a/Resources/Private/Fusion/Component/Atom/CookieBot/CookieBot.fusion b/Resources/Private/Fusion/Component/Atom/CookieBot/CookieBot.fusion new file mode 100644 index 0000000..36d62f5 --- /dev/null +++ b/Resources/Private/Fusion/Component/Atom/CookieBot/CookieBot.fusion @@ -0,0 +1,9 @@ +prototype(Avency.Neos.CookieBot:Component.Atom.CookieBot) < prototype(Neos.Fusion:Component) { + // API + scriptTag = '' + + // Rendering + renderer = afx` + {props.scriptTag} + ` +} diff --git a/Resources/Private/Fusion/Content/CookieBot.fusion b/Resources/Private/Fusion/Content/CookieBot.fusion new file mode 100644 index 0000000..0835466 --- /dev/null +++ b/Resources/Private/Fusion/Content/CookieBot.fusion @@ -0,0 +1,9 @@ +prototype(Avency.Neos.CookieBot:Content.CookieBot) < prototype(Neos.Neos:ContentComponent) { + // Rendering + renderer = Avency.Neos.CookieBot:Component.Atom.CookieBot { + key = ${!String.isBlank(q(site).property('cookieBotKey')) ? q(site).property('cookieBotKey') : Configuration.setting('Avency.Neos.CookieBot.key')} + + scriptTag = ${''} + scriptTag.@if.enable = ${!String.isBlank(this.key)} + } +} diff --git a/Resources/Private/Fusion/Override/Page.fusion b/Resources/Private/Fusion/Override/Page.fusion new file mode 100644 index 0000000..d0f6b10 --- /dev/null +++ b/Resources/Private/Fusion/Override/Page.fusion @@ -0,0 +1,9 @@ +prototype(Neos.Neos:Page) { + cookieBot = Neos.Fusion:Value { + key = ${!String.isBlank(q(site).property('cookieBotKey')) ? q(site).property('cookieBotKey') : Configuration.setting('Avency.Neos.CookieBot.key')} + value = ${''} + @if.enable = ${!String.isBlank(this.key)} + @if.notInBackend = ${!site.context.inBackend} + @position = 'before head' + } +} diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion new file mode 100644 index 0000000..fe1d560 --- /dev/null +++ b/Resources/Private/Fusion/Root.fusion @@ -0,0 +1 @@ +include: **/*.fusion diff --git a/Resources/Private/Translations/de/NodeTypes/Content/CookieBot.xlf b/Resources/Private/Translations/de/NodeTypes/Content/CookieBot.xlf new file mode 100644 index 0000000..eec19b0 --- /dev/null +++ b/Resources/Private/Translations/de/NodeTypes/Content/CookieBot.xlf @@ -0,0 +1,11 @@ + + + + + + Cookie declaration + Cookie-Erklärung + + + + diff --git a/Resources/Private/Translations/de/NodeTypes/Mixin/CookieBotKey.xlf b/Resources/Private/Translations/de/NodeTypes/Mixin/CookieBotKey.xlf new file mode 100644 index 0000000..2a4a93e --- /dev/null +++ b/Resources/Private/Translations/de/NodeTypes/Mixin/CookieBotKey.xlf @@ -0,0 +1,11 @@ + + + + + + CookieBot Key + CookieBot Key + + + + diff --git a/Resources/Private/Translations/en/NodeTypes/Content/CookieBot.xlf b/Resources/Private/Translations/en/NodeTypes/Content/CookieBot.xlf new file mode 100644 index 0000000..30141d3 --- /dev/null +++ b/Resources/Private/Translations/en/NodeTypes/Content/CookieBot.xlf @@ -0,0 +1,10 @@ + + + + + + Cookie declaration + + + + diff --git a/Resources/Private/Translations/en/NodeTypes/Mixin/CookieBotKey.xlf b/Resources/Private/Translations/en/NodeTypes/Mixin/CookieBotKey.xlf new file mode 100644 index 0000000..54b2389 --- /dev/null +++ b/Resources/Private/Translations/en/NodeTypes/Mixin/CookieBotKey.xlf @@ -0,0 +1,10 @@ + + + + + + CookieBot Key + + + +