2017 © Pedro Peláez
 

yii2-extension yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

image

easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  • Tuesday, February 13, 2018
  • by easyrider7522
  • Repository
  • 1 Watchers
  • 0 Stars
  • 207 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 1050 % Grown

The README.md

yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget, (*1)

Thanks to insites, (*2)

Installation

Composer

composer require easyrider7522/yii2-cookieconsent "@alpha"

or manually add to the required section of your project's composer.json, (*3)

"easyrider7522/yii2-cookieconsent": "@alpha"

and run composer update shell command, (*4)

Since it's a pre-release (currently in alpha state) stability flag @alpha must be used with the package (as you can see above) in order to be able to install it without changing minimum-stability property of the composer.json, which is global for your whole project., (*5)

Usage

As any Yii2 widget, in desired view or layout file as follows:, (*6)

<?php
use easyrider7522\cookieconsent\CookieConsent;

CookieConsent::widget([
    'lang'      => 'en',
    'options'   => [
        'palette'   => [
            'popup'     => [
                'background'    => '#222',
                'text'          => '#fff',
            ],
            'button'    => [
                'background'    => '#459f45',
                'text'          => '#fff',
            ],
        ],
        'theme'     => 'classic',
        'position'  => 'top',
        'type'      => 'opt-in',
        'content'   => [
            'message'   => 'This website uses cookies to ensure you get the best experience on our website.',
            'dismiss'   => 'Got it!',
            'link'      => 'Learn more',
            'href'      => 'http://cookiesandyou.com/',
        ],
    ],
]);

Customization can be easily done on the plugin developer's site and manually translated to PHP array., (*7)

Plugin settings object within JS, (*8)

Property optionJs was introduced for compatibility with native JS so, the chosen settings can be directly copied from the interactive configurator to it as string, containing the JavaScript object data (options property is ignored if optionsJs evaluates to true):, (*9)

CookieConsent::widget([
    'optionsJs' => '{
        "palette": {
            "popup": {
                "background": "#000"
            },
            "button": {
                "background": "#f1d600"
            }
        },
        "position": "top"
    }',
]);

Removal

composer remove easyrider7522/yii2-cookieconsent

or manually delete it from the required section of your project's composer.json and run composer update, (*10)

Dependencies

Cookie Consent, (*11)

Screenshots

Sample 1. Widget is overlapping Yii's default main menu ot the top of the page.

Cookie Consent Yii2 widget sample 1, (*12)

Sample 2. Widget is at the bottom of the page.

Cookie Consent Yii2 widget sample 2, (*13)

Sample 3. Widget is a box at page's bottom-right corner.

Cookie Consent Yii2 widget sample 3, (*14)

The Versions

13/02 2018

dev-master

9999999-dev https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522

12/02 2018

1.0.0-alpha.6

1.0.0.0-alpha6 https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522

12/02 2018

1.0.0-alpha.5

1.0.0.0-alpha5 https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522

12/02 2018

1.0.0-alpha.4

1.0.0.0-alpha4 https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522

12/02 2018

1.0.0-alpha.3

1.0.0.0-alpha3 https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522

12/02 2018

1.0.0-alpha.2

1.0.0.0-alpha2 https://github.com/easyrider7522/yii2-cookieconsent

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

  Sources   Download

MIT

The Requires

 

by Avatar easyrider7522

yii2 cookie yii yii 2 widget cookieconsent consent easyrider7522