Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kunstmaan/kunstmaancookiebundle
[READ-ONLY] Subtree split of the Kunstmaan CookieBundle -- master at Kunstmaan/KunstmaanBundlesCMS
https://github.com/kunstmaan/kunstmaancookiebundle
cms cookie gdpr kunstmaan
Last synced: about 2 months ago
JSON representation
[READ-ONLY] Subtree split of the Kunstmaan CookieBundle -- master at Kunstmaan/KunstmaanBundlesCMS
- Host: GitHub
- URL: https://github.com/kunstmaan/kunstmaancookiebundle
- Owner: Kunstmaan
- Created: 2018-05-22T06:54:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-13T14:41:01.000Z (9 months ago)
- Last Synced: 2024-04-14T04:39:43.123Z (9 months ago)
- Topics: cms, cookie, gdpr, kunstmaan
- Language: PHP
- Homepage:
- Size: 771 KB
- Stars: 0
- Watchers: 13
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
KunstmaanCookieBundle
=====================The Kunstmaan Cookie Bundle provides a cookie bar;
detailed pop-up window and a similar page
explaining each type of cookie used on the website.All provide the ability to accept or decline certain cookies.
# Original Contributors
| Username | Avatar
| :--------------:|:-----:
| [@sandergo90](https://github.com/sandergo90) | ![sandergo90](https://github.com/sandergo90.png?size=100)
| [@diskwriter](https://github.com/diskwriter) | ![diskwriter](https://github.com/diskwriter.png?size=100)
| [@indrikenens](https://github.com/indrikenens) | ![indrikenens](https://github.com/indrikenens.png?size=100)
| [@FVKVN](https://github.com/FVKVN) | ![FVKVN](https://github.com/FVKVN.png?size=100)
| [@dbeerten](https://github.com/dbeerten) | ![dbeerten](https://github.com/dbeerten.png?size=100)
| [@treeleaf](https://github.com/treeleaf) | ![treeleaf](https://github.com/treeleaf.png?size=100)
| [@KMBenjaminSchodts](https://github.com/KMBenjaminSchodts) | ![KMBenjaminSchodts](https://github.com/KMBenjaminSchodts.png?size=100)
| [@sector32](https://github.com/sector32) | ![treeleaf](https://github.com/sector32.png?size=100)# Enabling the bundle
## Add to Appkernel.php
## Add to routing.yml```
KunstmaanCookieBundle:
resource: "@KunstmaanCookieBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: "%requiredlocales%"
```## Two ways to view the cookie implementation
1: Login into the CMS
2: enable the cookie bundle under Settings -> Cookie configuration
# Importing the cookie bundle
## Show cookie on page
Add following block to the main layout of your website```
{# Kuma Cookie Bar #}
{% block kumacookiebar %}
{% endblock %}
```## CSS: First Method
Apply all CSS by importing the legal.scss file
into the vendors file of your project```
@import "vendor/kunstmaan/cookie-bundle/src/Resources/ui/scss/legal";
```## CSS: Second method
Import the Kunstmaan Cookie Bundle variables and imports to be overridden.
Copy the files at the following path to your project folder.vendor/kunstmaan/cookie-bundle/Resources/ui/scss/config/_variables.scss
vender/kunstmaan/cookie-bundle/Resources/ui/scss/config/_legal-imports.scssAlter variables and comment imports to fit the project's styling.
## Javascript
### Via ES Module pattern
```
import '../../../../../../vendor/kunstmaan/cookie-bundle/bin/';
```
### Via buildtool
You can include the compiled version in your buildtool - or directly in a template - via the following URL:
```
vendor/kunstmaan/cookie-bundle/src/Resources/ui/bin/index.js
```### Global methods
The CookieBundle exposes some utility methods that you can include in your project.
```
import {getKmccCookies} from '/kunstmaan/cookie-bundle/bin/'; // Returns the settings of all the cookies.
import {hasAllowedDatalayers} from '/kunstmaan/cookie-bundle/bin/'; // Shorthand to check if you're allowed to use dataLayers in this
project.
import {asyncDomInitiator} from '}
```Both these methods are also available on the global scope for projects that do not have bundlers:
```
window.kmcc.getKmccCookies();
window.kmcc.hasAllowedDatalayers();
window.kmcc.asyncDomInitiator({
nodeTree:
});
```# Commands
## Copy Cookiebar Resources to your project
Default command:
```
php bin/console kuma:generate:legal --prefix foo_ --demosite
```
or, if you have previously generated files and wish to override them:
php bin/console kuma:generate:legal --prefix will_ --demosite --overrideFiles## Migrate
```
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```## Generate fixtures
```
php bin/console d:f:l --fixtures src/foo/AppBundle/DataFixtures/ORM/LegalGenerator/DefaultFixtures.php --append
```## Add the optin pagepart to your form pages.
We added an extra LegalOptInPagePart that behaves like a checkbox but adds the extra of a link to the privacy policy directly.The pagepart will be generated in your bundle and you will have to include it in your pagepart configuration yaml file.
```
- { name: 'Opt In', class: Foo\WebsiteBundle\Entity\PageParts\LegalOptInPagePart }
```## Easily generate links for your project that open the cookie modal:
Add by using this snippet you can easily add the necessary links to your project in custom places like a footer:
```
{% if is_granted_for_cookie_bundle(app.request) %}
{% set legalLinks = ['legal_privacy_policy', 'legal_cookie_preferences', 'legal_contact'] %}
{% for internalName in legalLinks %}
{% set node = nodemenu.getNodeByInternalName(internalName) %}
{% if (node is not null) %}
-
{{ node.title }}
{% endif %}
{% endfor %}
{% endif %}
```## Overriding translations
If you want to override the translations of the cookie bundle, you need to add the following configuration in your config.yml
beneath the existing kunstmaan_translator config.```
kunstmaan_translator:
default_bundle: custom
bundles:
- KunstmaanCookieBundle
- YourOwnBundle
```## Add visitor type to google analytics
We added the possibility to push a datalayer to google analytics with the type of visitor viewing your website. A new Config entity has been added
where you can add the ip-addresses of clients or internal. Those ip's will be checked on request and a datalayer will be pushed.If you want to use this functionality, please read the documentation for the Config Bundle to setup. When you did this, add the following snippet to your config.yml.
```
kunstmaan_config:
entities:
- Kunstmaan\CookieBundle\Entity\CookieConfig
```Following input field should be added to your layout.html.twig. You can add in beneath the kuma-cookie-bar element.
```
```
## Increase version number when adding cookies/types or changing stuff the requires new cookie consent.
In the cookie configuration, there is a version number available. This version number can be increased in the CMS.
### Contributing
We love contributions!
If you're submitting a pull request, please follow the guidelines in the [Submitting pull requests](docs/pull-requests.md)