Download the PHP package sandstorm/neos-cookieconsent without Composer
On this page you can find all versions of the php package sandstorm/neos-cookieconsent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package neos-cookieconsent
Sandstorm CookieConsent
THIS PACKAGE IS NO LONGER MAINTANED
You should have a look at our CookiePunch Package
This package helps you create a cookie consent that is more fine-grained than most others.
- Can be configured by the integrator
- All text elements of the popup can be customized by the editor of your site (for the parts that the integrator chooses to expose towards the neos editor through the backend ui)
- Multi-Language compatible (automatic translation of all labels in the modal and customizable texts through Neos content dimensions)
- Easily extensible -> Apps can simply be added and configured as nodetypes
Table of contents
- Compatibility and Maintenance
- Quickstart
- 1. Add your own derived Node Type.
- 2. Add the Node Type somewhere to your page
- 3. Add rendering for your Node Type
- 4. Set the privacy policy link
- 5. Translate the modal (optional)
- 6. Add apps that need a users consent
- 7. Place your new Component in your markup
- 8. Placing the Cookie-Manager button
- Customization
- 1. Thing to customize
- 2. Thing to customize
- Next steps / possible further development
- License & Copyright
Compatibility and Maintenance
This package is currently being maintained for Neos 4.3 LTS. It is stable, we use it in our projects.
Neos / Flow Version | Sandstorm.CookieConsent Version | Maintained |
---|---|---|
Neos 4.3 LTS, Flow 5.3 LTS | 1.x | Yes |
Quickstart
1. Add your own derived Node Type.
Here we decided to place the link to your privacy policy in the inspector of the node type of CookieConsent. We also specify a tab and a group in which it will appear.
2. Add the Node Type somewhere to your page
For example as child node:
3. Add rendering for your Node Type
This package provides you with a rendering component that takes care of loading the javascript and css needed. It also configures the library so it knows about any apps for which you need a consent by the user.
Your fusion component acts as the integrational component, Sandstorm.CookieConsent:Component.CookieConsent
is the presentational component.
A simplified example:
4. Set the privacy policy link
In this example it was decided to let the editor change the privacy policy link in the Neos inspector.
The example assumes you placed it directly below your root page (= site-node). Make sure to adapt to your node paths depending on where you placed the node.
5. Translate the modal (optional)
The cookie consent can be translated. It has reasonable defaults for many languages and will try to determine the language of
your page automatically (for example by looking at your <html lang>
attribute.
For available translations see the github repo.
Note the fusion key _cookieModalTranslations
. It reads more properties from the CookieConsent nodetype that we defined in step 1.
One will be added as an example below. You can also provide static strings and not let the editor change the keys in the inspector in the
Neos backend - it's up to you. Here the editor is supposed to provide their own texts.
The easiest way to find out what you can translate is to change the language of the cookieConsent to something that does not exist, e.g. "foo" (see in the renderer of the following component, there the language key is passed as a property). In the frontend it will then fail to load translations and tell you the path where it was looking for the translation.
6. Add apps that need a users consent
The package comes with a few apps (e.g. Google Analytics liable for consent already preconfigured that you can just add from the Neos backend to the collection of app below your CookieConsent node.
In case you need an app that's not yet included, simply copy one of the existing node types and fill in the necessary information.
Please open a pull request or an issue with your apps configuration so others can benefit from it :)
7. Place your new Component in your markup
Render your new component somewhere on your page.
body.some.fusion.path.cookieConsent = Vendor.Site:CookieConsent
8. Placing the Cookie-Manager button
To allow your users to revisit their cookie settings, you need to place a special button
component somewhere on your site.
We already provide a NodeType and its respective fusion component for this.
Simply allow 'Sandstorm.CookieConsent:OpenCookieManagerButton': true
in one of your content
collection configurations and add the component to your site (preferably on your data policy page).
Customization
TODO
1. Thing to customize
2. Thing to customize
Next steps / possible further development
License & Copyright
MIT-Licensed, (c) Sandstorm Media GmbH 2020