diff --git a/.php-version.dist b/.php-version.dist index 2983cad..cf02201 100644 --- a/.php-version.dist +++ b/.php-version.dist @@ -1 +1 @@ -8.2 +8.3 diff --git a/Makefile b/Makefile index 74998f3..508baa8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL := help SHELL=/bin/bash APP_DIR=tests/Application -SYLIUS_VERSION=1.13.0 +SYLIUS_VERSION=2.0.0 SYMFONY=cd ${APP_DIR} && symfony COMPOSER=symfony composer CONSOLE=${SYMFONY} console diff --git a/composer.json b/composer.json index 472efb4..502f4eb 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,8 @@ "description": "Adds a simple message on top of your shop.", "license": "MIT", "require": { - "php": "^8.0", - "sylius/sylius": ">=1.11 <1.14" + "php": "^8.2", + "sylius/sylius": "~2.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.16", @@ -36,7 +36,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "2.0-dev" }, "symfony": { "docker": false, diff --git a/src/Helper/MessageHelper.php b/src/Helper/MessageHelper.php index 1fa363d..ce25409 100644 --- a/src/Helper/MessageHelper.php +++ b/src/Helper/MessageHelper.php @@ -15,12 +15,11 @@ use MonsieurBiz\SyliusAlertMessagePlugin\Entity\Message; use MonsieurBiz\SyliusAlertMessagePlugin\Repository\MessageRepositoryInterface; -use Sonata\BlockBundle\Model\Block; use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Customer\Context\CustomerContextInterface; use Sylius\Component\Locale\Context\LocaleContextInterface; -final class MessageHelper extends Block +final class MessageHelper { /** * @var ChannelContextInterface @@ -51,7 +50,6 @@ public function __construct( CustomerContextInterface $customerContext, MessageRepositoryInterface $messageRepository ) { - parent::__construct(); $this->channelContext = $channelContext; $this->localeContext = $localeContext; $this->customerContext = $customerContext; diff --git a/src/Resources/config/config.yaml b/src/Resources/config/config.yaml index f557523..0a4e125 100644 --- a/src/Resources/config/config.yaml +++ b/src/Resources/config/config.yaml @@ -1,5 +1,5 @@ imports: - { resource: "sylius/resources.yaml" } - { resource: "sylius/grid.yaml" } - - { resource: "sylius/ui_events.yaml" } + - { resource: "sylius/twig_hooks.yaml" } - { resource: "sylius/fixtures.yaml" } diff --git a/src/Resources/config/routing/admin.yaml b/src/Resources/config/routing/admin.yaml index 35e1724..57ceb52 100644 --- a/src/Resources/config/routing/admin.yaml +++ b/src/Resources/config/routing/admin.yaml @@ -3,7 +3,7 @@ monsieurbiz_sylius_alert_message_admin: alias: monsieurbiz_alert_message.message section: admin permission: true - templates: "@SyliusAdmin\\Crud" + templates: "@SyliusAdmin\\shared\\crud" except: ['show'] redirect: update grid: monsieurbiz_alert_message diff --git a/src/Resources/config/sylius/twig_hooks.yaml b/src/Resources/config/sylius/twig_hooks.yaml new file mode 100644 index 0000000..7a64bc4 --- /dev/null +++ b/src/Resources/config/sylius/twig_hooks.yaml @@ -0,0 +1,6 @@ +sylius_twig_hooks: + hooks: + 'sylius_shop.base.header': + monsieurbiz.alertmessage.message: + template: '@MonsieurBizSyliusAlertMessagePlugin/message.html.twig' + priority: 900 diff --git a/src/Resources/config/sylius/ui_events.yaml b/src/Resources/config/sylius/ui_events.yaml deleted file mode 100644 index 365fc54..0000000 --- a/src/Resources/config/sylius/ui_events.yaml +++ /dev/null @@ -1,6 +0,0 @@ -sylius_ui: - events: - sylius.shop.layout.before_body: - blocks: - monsieurbiz.alertmessage.message: - template: '@MonsieurBizSyliusAlertMessagePlugin/message.html.twig' diff --git a/src/Resources/views/_default_template.html.twig b/src/Resources/views/_default_template.html.twig index 72f25ed..4ab55f7 100644 --- a/src/Resources/views/_default_template.html.twig +++ b/src/Resources/views/_default_template.html.twig @@ -1,6 +1,6 @@ -
+