Giter VIP home page Giter VIP logo

ezsystemsprivacycookiebundle's Introduction

Privacy Cookie Bundle

SensioLabsInsight

This bundle adds privacy cookie banner into Symfony applications.

screenshot

Requirements

  • Symfony v2.6 or later (including Symfony 3.x)

Installation

This package is available via Composer, so the instructions below are similar to how you install any other open source Symfony Bundle.

Run the following command in a terminal, from your Symfony installation root (pick most recent release):

php composer.phar require ezsystems/privacy-cookie-bundle

Enable the bundle in app/AppKernel.php file:

$bundles = array(
    // existing bundles
    new EzSystems\PrivacyCookieBundle\EzSystemsPrivacyCookieBundle(),
);

Add external assets to your bundle:

  • CSS:
bundles/ezsystemsprivacycookie/css/privacycookie.css
  • JS:
bundles/ezsystemsprivacycookie/js/privacycookie.js

Assetic (Optional)

Enable the Assetic bundle in app/AppKernel.php file:

$bundles = array( // ... // starting from Symfony 2.8 you have to enable AsseticBundle manually if you haven't done it before new Symfony\Bundle\AsseticBundle\AsseticBundle() );

Add the following minimal configuration in config.yml file to enable Assetic support in your application (Symfony 2.8 and later):

assetic:
    debug: '%kernel.debug%'
    use_controller: '%kernel.debug%'
    filters:
        cssrewrite: ~

If you are installing the bundle via composer require you must also copy assets to your project's web directory. You can do this by calling Symfony's built-in command from the project root directory:

For Symfony 2.x:

php app/console assets:install --symlink

For Symfony 3.x:

php bin/console assets:install --symlink

In production environment you have to dump assets using Assetic built-in command:

For Symfony 2.x:

php app/console assetic:dump -e=prod

For Symfony 3.x:

php bin/console assetic:dump -e=prod

Usage

Insert the following {{ show_privacy_cookie_banner(%privacy_policy_url%) }} helper somewhere in your footer template before the body ending tag. Replace the %privacy_policy_url% parameter with your policy page address.

Note that the %privacy_policy_url% parameter is not required, in this case no policy link will be shown.

The following optional parameters can be set as a second argument in an array format:

Parameter Default value Description
cookieName privacyCookieAccepted Sets your own status cookie name
cookieValidity 365 Says how many days privacy banner should be hidden when user accepts policy?
cookiePath null Specifies the cookie path (by default cookie will be available only for the current domain)
caption Cookies help us create a good experience (...) Sets your own banner message caption
learnMoreText Learn More Sets title and text of privacy link
extraParams Extra Params Send extra params in your override template

Example of usage in standard Symfony application:

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy') }}

or

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy', {
   cookieName: 'myCookie',
   cookieValidity: 7,
   cookiePath: '/',
   caption: 'Nice to see you here',
   learnMoreText: 'Find out more'
}) }}

If you are using eZ Publish / Platform you can use ez_urlalias to generate path for specified content object:

{{ show_privacy_cookie_banner(path('ez_urlalias', {contentId: 94}), {
   cookieName: 'myCookie',
   cookieValidity: 7,
   caption: 'Nice to see you here'
}) }}

Example of usage extraParams:

{{ show_privacy_cookie_banner('http://ez.no/Privacy-policy', {
   cookieName: 'myCookie',
   extraParams: {
       my_param1: value_my_param1 ,
       my_param2: value_my_param2
   }
}) }}

ezsystemsprivacycookiebundle's People

Contributors

amauryvallier avatar andrerom avatar anijra avatar bedo-abn avatar clash82 avatar krzyraj avatar nicodmf avatar vidarl avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ezsystemsprivacycookiebundle's Issues

Symfony 3 compatibility

Hi,
I have tried to install your bundle, but... As I am using symfony 3 it breaks as your composer.json require "symfony/symfony": "~2.6".
Is it compatible with symfony 3 ? if not, will it be ?
Thanks

Catchable Fatal Error on construct

Hello,

For information, I've just updated from e93f0af to 6f794ee, and now, I have an error :

ContextErrorException: Catchable Fatal Error: Argument 2 passed to EzSystems\PrivacyCookieBundle\Twig\PrivacyCookieTwigExtension::__construct() must be an instance of EzSystems\PrivacyCookieBundle\Banner\Banner, instance of EzSystems\PrivacyCookieBundle\Factory\ConfigurationBasedBannerFactory given, called in /var/www/xxxxx/ezpublish/cache/dev/ezpublishDevDebugProjectContainer.php on line 2023 and defined in /var/www/xxxxxx/vendor/ezsystems/privacy-cookie-bundle/Twig/PrivacyCookieTwigExtension.php line 29

It seems related to #3.

Standard call in the pagelayout : {{ show_privacy_cookie_banner('http://ez.no/Privacy-policy') }}

Am I the only one with this problem ?

The notification is repeated in all pages

Hi. I am writing to you because I use your bundle on my website. The problem is the following: the notice of use of cookies goes out in each of the pages, when they are visited for the first time, although the user has already accepted on the home page of the site.

Librarie dependency problem

We cannot use this bundle out of the box.

I get this error:

Attempted to load class "Configuration" from namespace "eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware"

So this bundle needs eZ\Bundle\EzPublishCoreBundle to work, and it is not in composer.json.

Either this bundle is part of the whole eZ CMS, or Configuration class should not extends SiteAccessConfiguration, but just implement Symfony\Component\Config\Definition\ConfigurationInterface in order to work out of the box.

Out of style

The banner shows like a text, with no style what so ever and the button for "Ok" does not work!

Symfony 3 compatibility

Hello!

Thanks for this bundle
Could you make it compatible with SF 3 ?

Many thanks
Olivia

Google Analytics Cookie

Hi,
how can I use the bunde for Google Analytics Cookie?
When the user does not agree to accept the cookies, the bundle must block the Google Analytics.

Can't install with eZ Platform 2.1

Hello. i'm trying to install this bundle but the composer command says

Problem 1
    - Installation request for ezsystems/privacy-cookie-bundle ^0.2.0 -> satisfiable by ezsystems/privacy-cookie-bundle[v0.2].
    - ezsystems/privacy-cookie-bundle v0.2 requires symfony/symfony ~2.6 -> satisfiable by symfony/symfony[2.6.x-dev, 2.7.x-dev, 2.8.x-dev, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.40, v2.7.41, v2.7.42, v2.7.43, v2.7.44, v2.7.45, v2.7.46, v2.7.47, v2.7.48, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.33, v2.8.34, v2.8.35, v2.8.36, v2.8.37, v2.8.38, v2.8.39, v2.8.4, v2.8.40, v2.8.41, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9] but these conflict with your requirements or minimum-stability.

which is weird, as in the composer.json we have `^2.6|^3.0'.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.