Add a simple cookie alert to your shop
This plugin is only for Sylius 1.7.x because it uses the new template events architecture. The following instructions are compatible with Bootstrap and Webpack Encore. This plugin is in beta.
- Install Sylius
- Add the bundle and dependencies in your
composer.json
composer require black/sylius-cookie-alert-plugin:^1.0.0@dev
- Register the bundle:
<?php
// config/bundles.php
return [
// ...
Black\SyliusCookieAlertPlugin\BlackSyliusCookieAlertPlugin::class => ['all' => true],
];
- Import the configuration
# config/packages/sylius_cookie_alert.yaml
imports:
- { resource: "@BlackSyliusCookieAlertPlugin/config/app/config.php" }
- Add the cookie-alert javascript dependency
yarn add bootstrap-cookie-alert
- Add the cookie-alert dependency in your main javascript file
require('bootstrap-cookie-alert/cookiealert');
- Add the cookie alert dependency in your main scss file
@import '~bootstrap-cookie-alert/cookiealert.css';
This plugin adds a new block in sylius.shop.layout.after_body
with src/Resources/views/_cookieAlert.html.twig
.
Feel free to change this behavior, override the template but I think you should use events...
sylius_ui:
events:
sylius.shop.layout.after_body:
blocks:
cookie:
template: "@BlackSyliusCookieAlertPlugin/_cookieAlert.html.twig"
priority: 1
-
Run
composer create-project pocky/modern-plugin-skeleton ProjectName
or clone this project -
From the plugin skeleton root directory, run the following commands:
$ sudo chmod -Rf 777 tests/Application/var
$ docker-compose exec php php -d memory_limit=-1 /usr/bin/composer install
$ docker-compose exec nodejs yarn --cwd tests/Application install
$ docker-compose exec php tests/Application/bin/console doctrine:database:create --if-not-exists -vvv
$ docker-compose exec php tests/Application/bin/console doctrine:schema:create -vvv
$ docker-compose exec php tests/Application/bin/console assets:install tests/Application/public -vvv
$ docker-compose exec nodejs yarn --cwd tests/Application build
$ docker-compose exec php tests/Application/bin/console cache:warmup -vvv
$ docker-compose exec php tests/Application/bin/console sylius:fixtures:load -n
$ docker-compose exec php composer validate --ansi --strict
$ docker-compose exec php vendor/bin/phpstan analyse -c phpstan.neon -l max src/
$ docker-compose exec php vendor/bin/psalm
$ docker-compose exec php vendor/bin/phpspec run --ansi -f progress --no-interaction
$ docker-compose exec php vendor/bin/phpunit --colors=always
$ docker-compose exec php vendor/bin/behat --profile docker --colors --strict -vvv --no-interaction
ProTip use Makefile
;)
- tl;dr :
- Modifications must be shared,
- It's possible to use this plugin in a commercial project,
- A commercial license is available.
This project is licensed under EUPL-1.2. This license implies that if you modify this plugin, you must share those modifications (like AGPL). However, the EUPL-1.2 license applies only on this plugin and this is not viral (like LGPL).
If you don't want to follow this or do not want to use EUPL-1.2 licensed software, you must buy commercial license. Contact us for more information.
Created by Alexandre Balmes.
This project was made possible thanks to the support of: