black/sylius-cookie-alert-plugin

Add cookie alert to your shop

Installs: 1 884

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 2

Open Issues: 2

Type:sylius-plugin

This package is auto-updated.

Last update: 2022-09-08 16:55:46 UTC


README

68747470733a2f2f64656d6f2e73796c6975732e636f6d2f6173736574732f73686f702f696d672f6c6f676f2e706e67

Cookie Alert Plugin

Add a simple cookie alert to your shop

Warning

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.

Installation

  1. Install Sylius
  2. Add the bundle and dependencies in your composer.json

composer require black/sylius-cookie-alert-plugin:^1.0.0@dev

  1. Register the bundle:
<?php

// config/bundles.php

return [
    // ...
    Black\SyliusCookieAlertPlugin\BlackSyliusCookieAlertPlugin::class => ['all' => true],
];
  1. Import the configuration
# config/packages/sylius_cookie_alert.yaml
imports:
    - { resource: "@BlackSyliusCookieAlertPlugin/config/app/config.php" }
  1. Add the cookie-alert javascript dependency yarn add bootstrap-cookie-alert
  2. Add the cookie-alert dependency in your main javascript file
  require('bootstrap-cookie-alert/cookiealert');
  1. Add the cookie alert dependency in your main scss file
@import '~bootstrap-cookie-alert/cookiealert.css';

Usage

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

Quickstart Installation (docker)

  1. Run composer create-project pocky/modern-plugin-skeleton ProjectName or clone this project

  2. 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

Quality tools

$ 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 ;)

License and Copyright

  • 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.

Credits

Created by Alexandre Balmes.

Sponsors

This project was made possible thanks to the support of:

Vanoix.com