Skip to content

Commit

Permalink
feat: add sylius 2.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
delyriand committed Dec 5, 2024
1 parent 91e5721 commit 9ea12e8
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .php-version.dist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2
8.3
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "2.0-dev"
},
"symfony": {
"docker": false,
Expand Down
4 changes: 1 addition & 3 deletions src/Helper/MessageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,7 +50,6 @@ public function __construct(
CustomerContextInterface $customerContext,
MessageRepositoryInterface $messageRepository
) {
parent::__construct();
$this->channelContext = $channelContext;
$this->localeContext = $localeContext;
$this->customerContext = $customerContext;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/config.yaml
Original file line number Diff line number Diff line change
@@ -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" }
2 changes: 1 addition & 1 deletion src/Resources/config/routing/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/Resources/config/sylius/twig_hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sylius_twig_hooks:
hooks:
'sylius_shop.base.header':
monsieurbiz.alertmessage.message:
template: '@MonsieurBizSyliusAlertMessagePlugin/message.html.twig'
priority: 900
6 changes: 0 additions & 6 deletions src/Resources/config/sylius/ui_events.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions src/Resources/views/_default_template.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="ui error message" style="margin: 0; border-radius: 0">
<div class="alert alert-danger mb-0" role="alert">
{% if message.title is defined -%}
<div class="header">{{ message.title }}</div>
<div class="h5">{{ message.title }}</div>
{%- endif %}
<div>{{ message.message|raw }}</div>
</div>

0 comments on commit 9ea12e8

Please sign in to comment.