uam/cookie-consent-bundle

添加横幅,允许用户同意您symfony应用程序的cookie政策

1.0.6 2017-04-26 12:55 UTC

This package is auto-updated.

Last update: 2024-08-29 03:42:05 UTC


README

一个提供方便方式允许用户同意symfony应用程序cookie政策的symfony 2捆绑包。

安装

将捆绑包添加到项目的composer.json

{
    "require": {
        "uam/cookie-consent-bundle": "^1.0",
        ...
    }
}

运行composer installcomposer update来安装捆绑包

$ php composer.phar update

在应用程序的内核中启用捆绑包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new UAM\CookieConsent\CookieConsentBundle\UAMCookieConsentBundle(),
    );
}

如果您的composer.json不包含post-install或post-update的installAssets脚本处理器,则运行以下命令

$ php app/console assets:install

或者

$ php app/console assets:install --symlink

使用方法

# base.html.twig

{% stylesheets filter="cssrewrite"
    'bundles/uamcookieconsent/css/cookie-consent.css'
%}
	<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}

{% javascripts
	'bundles/uamcookieconsent/js/cookie-consent.js'
%}
	<script src="{{ asset_url }}"></script>
{% endjavascripts %}

如果您使用assetic,您需要在配置文件的assetic部分声明UAMCookieConsentBundle。

# base.html.twig

{% stylesheets filter="cssrewrite"
    '@uam_cookie_consent_css'
%}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}

{% javascripts
    '@uam_cookie_consent_js'
%}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

许可证

此捆绑包采用MIT许可证。

dataTables jQuery插件采用MIT许可证。

版权

此捆绑包由United Asian Management Limited版权所有。

dataTables jQuery插件由Allan Jardine (www.sprymedia.co.uk)版权所有。

所有权利均由各自的版权所有者保留。