twin-elements / gdpr-cookies-bundle
GDPR cookies for CMS
Installs: 185
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.0
- symfony/framework-bundle: ^4.4 || ^5.4 || ^6.2
README
1.Install
composer require twin-elements/gdpr-cookies-bundle
2.in routing.yaml file
gdpr_cookies:
resource: "@TwinElementsGDPRCookiesBundle/Controller/"
prefix: /
type: annotation
requirements:
_locale: '%app_locales%'
defaults:
_locale: '%locale%'
_admin_locale: '%admin_locale%'
options: { i18n: false }
3.In bundles.php file
TwinElements\GDPRCookiesBundle\TwinElementsGDPRCookiesBundle::class => ['all' => true],
- Configuration If you have created route "cookies_policy" leave package settings (config/packages/twin_elements_gdpr_cookies.yaml) unchanged
twin_elements_gdpr_cookies: ~
If you want to change the default route to your own, enter it in the package configuration
twin_elements_gdpr_cookies:
cookies_policy_route: your_route_name
in webpack.config.js
create alias for root dir:
const rootDir = path.resolve(__dirname, '');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('common', './assets/js/app.js')
;
const frontConfig = Encore.getWebpackConfig();
frontConfig.resolve.alias['root-dir'] = rootDir;
frontConfig.name = 'frontConfig';
Encore.reset();
Import cookies.js
import 'root-dir/public/bundles/twinelementsgdprcookies/js/cookies';
##How it use?
For marketing codes
{% if isMarketingAccepted() %}{% endif %}
Form analytics codes
{% if isAnalyticsAccepted() %}{% endif %}
In base template add
<div id="cookies-base-container"></div>
To overwrite translations, create a cookies.LOCALE.yaml
file and enter your own translations