easyrider7522/yii2-cookieconsent 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

easyrider7522/yii2-cookieconsent

Composer 安装命令:

composer require easyrider7522/yii2-cookieconsent

包简介

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

README 文档

README

Implementation of Cookie Consent v3 cookie usage warner as Yii2 widget

Thanks to insites

Installation

Composer

composer require easyrider7522/yii2-cookieconsent "@alpha"

or manually add to the required section of your project's composer.json

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

and run composer update shell command

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.

Usage

As any Yii2 widget, in desired view or layout file as follows:

<?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.

Plugin settings object within JS

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):

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

Dependencies

Cookie Consent

Screenshots

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

Cookie Consent Yii2 widget sample 1

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

Cookie Consent Yii2 widget sample 2

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

Cookie Consent Yii2 widget sample 3

统计信息

  • 总下载量: 3.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固