├── widgets ├── views │ └── cookieWidget.php └── CookieWidget.php ├── composer.json ├── assets └── CookieAsset.php └── README.md /widgets/views/cookieWidget.php: -------------------------------------------------------------------------------- 1 | assetBundles[CookieAsset::class]; 19 | 20 | // Create codeJS 21 | $codeJS = "window.cookieconsent_options = { message: '{$message}', dismiss: '{$dismiss}', learnMore: '{$learnMore}', link: '{$link}', theme: '{$theme}', container: '{$container}', path: '{$path}',"; 22 | 23 | if($domain){ 24 | $codeJS .= " domain: '{$domain}',"; 25 | } 26 | 27 | $codeJS .= " expiryDays: {$expiryDays} };"; 28 | 29 | $this->registerJs($codeJS, \yii\web\View::POS_END); 30 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cinghie/yii2-cookie-consent", 3 | "description": "Yii2 Cookie Consent to alerting users about the use of cookies on your Yii2 website.", 4 | "keywords": [ 5 | "yii2", 6 | "yii2 cookie", 7 | "yii2 cookie law", 8 | "yii2 cookie consent", 9 | "yii2 eu cookie consent" 10 | ], 11 | "homepage": "https://github.com/cinghie/yii2-cookie-consent", 12 | "type": "yii2-extension", 13 | "license": "BSD-3-Clause", 14 | "authors": [ 15 | { 16 | "name": "Gogodigital.it", 17 | "email": "info@gogodigital.it", 18 | "homepage": "http://www.gogodigital.it/" 19 | } 20 | ], 21 | "require": { 22 | "yiisoft/yii2": "^2.0.14", 23 | "bower-asset/cookieconsent": "^3.1.1" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "cinghie\\cookieconsent\\": "" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assets/CookieAsset.php: -------------------------------------------------------------------------------- 1 | 'This website uses cookies to ensure you get the best experience on our website.', 39 | 'dismiss' => 'Got It', 40 | 'learnMore' => 'More info', 41 | 'link' => 'http://silktide.com/privacy-policy', 42 | 'theme' => 'dark-bottom' 43 | ]); ?> 44 | ``` 45 | 46 | Theme Options 47 | ----------------- 48 | 49 |