andrewdanilov/yii2-cookies-agreement 问题修复 & 功能扩展

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

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

andrewdanilov/yii2-cookies-agreement

最新稳定版本:1.0.3

Composer 安装命令:

composer require andrewdanilov/yii2-cookies-agreement

包简介

Sticky footer panel widget, which lets your visitors to accept user policy agreement.

README 文档

README

Sticky footer panel widget, which lets your visitors to accept user policy agreement.

Installation

The preferred way to install this extension is through composer.

Either run

composer require andrewdanilov/yii2-cookies-agreement "~1.0.0"

or add

"andrewdanilov/yii2-cookies-agreement": "~1.0.0"

to the require section of your composer.json file.

Usage

Place widget at any place of desired layout:

<?php
echo CookiesAgreement::widget([
    'message' => 'By continuing to use our site, you consent to the processing of cookies and other user data, in accordance with this notice on their use. If you do not agree to these terms, please disable cookies. Learn more about <a href="{url}">privacy policy</a>.', // optional
    'url' => 'https://example.com/agreement', // optional, use if {url} tag presents in message property
]);

For message you can use i18n if you want. Adjust config file as needed:

<?php
'components' => [
    // ...
    'i18n' => [
        'translations' => [
            'app*' => [
                'class' => 'yii\i18n\PhpMessageSource',
                //'basePath' => '@app/messages',
                //'sourceLanguage' => 'en-US',
                'fileMap' => [
                    'app' => 'app.php',
                ],
            ],
        ],
    ],
],

Then add needed translation to app/messages/ru-RU/app.php:

<?php
/**
* Translation map for en-US
*/
return [
    'By continuing to use our site, you consent to the processing of cookies and other user data, in accordance with this notice on their use. If you do not agree to these terms, please disable cookies. Learn more about <a href="{url}">privacy policy</a>.'
        => 'Продолжая использовать наш сайт, вы даете согласие на обработку файлов Cookies и других пользовательских данных, в соответствии с настоящим уведомлением об их использовании. Если вы не согласны с этими условиями, пожалуйста, отключите файлы cookies. Подробнее о <a href="{url}">политике конфиденциальности</a>.',
];

Read i18n manual for more details.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-14