Skip to content

Commit f0e09f6

Browse files
authored
Merge pull request #83 from lanfisis/feat/sylius-2.0
2 parents a8b0875 + e0f9458 commit f0e09f6

File tree

74 files changed

+637
-656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+637
-656
lines changed

.github/workflows/recipe.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Flex Recipe
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ $default-branch ]
66
pull_request:
77

88
jobs:
@@ -14,8 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
18-
sylius: ["~1.12.0", "~1.13.0", "1.14.0"]
17+
php: ['8.2', '8.3']
18+
sylius: ['~2.0.0']
1919

2020
steps:
2121
- name: Setup PHP

.github/workflows/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: ['8.1', '8.2', '8.3']
16+
php: ['8.2', '8.3']
1717

1818
steps:
1919
- uses: actions/checkout@v3

.github/workflows/tests.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ $default-branch ]
66
pull_request:
77

88
jobs:
@@ -14,7 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
17+
php: ['8.2', '8.3']
18+
node: ['20']
1819

1920
env:
2021
SYMFONY_ARGS: --no-tls
@@ -25,7 +26,7 @@ jobs:
2526
- uses: actions/checkout@v2
2627
- uses: actions/setup-node@v2
2728
with:
28-
node-version: '14'
29+
node-version: ${{ matrix.node }}
2930
- name: Setup PHP
3031
uses: shivammathur/setup-php@v2
3132
with:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.14.0
4+
SYLIUS_VERSION=2.0.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console

README.md

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@
77
[![Recipe Status](https://img.shields.io/github/actions/workflow/status/monsieurbiz/SyliusCmsPagePlugin/recipe.yaml?branch=master&label=recipes&logo=github)](https://github.com/monsieurbiz/SyliusCmsPagePlugin/actions?query=workflow%3ASecurity)
88
[![Security Status](https://img.shields.io/github/actions/workflow/status/monsieurbiz/SyliusCmsPagePlugin/security.yaml?branch=master&label=security&logo=github)](https://github.com/monsieurbiz/SyliusCmsPagePlugin/actions?query=workflow%3ASecurity)
99

10-
This plugins allows you to add manage CMS pages using the Rich Editor.
10+
This plugins allows you to add manage CMS pages using the Rich Editor and the Media Manager.
1111

12-
If you want to know more about our editor, see the [Rich Editor Repository](https://github.com/monsieurbiz/SyliusRichEditorPlugin)
12+
If you want to know more about our editor, see the [Rich Editor Plugin](https://github.com/monsieurbiz/SyliusRichEditorPlugin)
13+
If you want to know more about our editor, see the [Media Manager Plugin](https://github.com/monsieurbiz/SyliusMediaManagerPlugin)
1314

14-
![Example of CMS page creation](screenshots/demo.gif)
15+
![Example of CMS Page display](screenshots/front-example.png)
1516

1617
## Compatibility
1718

1819
| Sylius Version | PHP Version |
1920
|----------------|-----------------|
20-
| 1.12 | 8.1 - 8.2 - 8.3 |
21-
| 1.13 | 8.1 - 8.2 - 8.3 |
22-
| 1.14 | 8.1 - 8.2 - 8.3 |
21+
| 2.0 | 8.2 - 8.3 |
22+
23+
ℹ️ For Sylius 1.x, see our [1.x branch](https://github.com/monsieurbiz/SyliusCmsPagePlugin/tree/1.x) and all 1.x releases.
2324

2425
## Installation
2526

@@ -33,6 +34,8 @@ composer config --no-plugins --json extra.symfony.endpoint '["https://api.github
3334
composer require monsieurbiz/sylius-cms-page-plugin
3435
```
3536

37+
If you do not use the recipes :
38+
3639
Change your `config/bundles.php` file to add the line for the plugin :
3740

3841
```php
@@ -58,9 +61,25 @@ monsieurbiz_cms_page_admin:
5861
resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/admin.yaml"
5962
prefix: /%sylius_admin.path_name%
6063
61-
monsieurbiz_cms_page_shop:
62-
resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/shop.yaml"
63-
prefix: /{_locale}
64+
# Show page
65+
monsieurbiz_cms_page_show:
66+
path: /{_locale}/{slug}
67+
methods: [GET]
68+
requirements:
69+
slug: .+
70+
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
71+
defaults:
72+
_controller: monsieurbiz_cms_page.controller.page::showAction
73+
_sylius:
74+
template: "@MonsieurBizSyliusCmsPagePlugin/shop/page/show.html.twig"
75+
repository:
76+
method: findOneEnabledAndPublishedBySlugAndChannelCode
77+
arguments:
78+
- $slug
79+
- "expr:service('sylius.context.locale').getLocaleCode()"
80+
- "expr:service('sylius.context.channel').getChannel().getCode()"
81+
- "expr:service('monsieurbiz.cms_page.datetime_provider').now()"
82+
condition: "not(context.getPathInfo() matches '`^%sylius.security.api_route%`') and context.checkPageSlug(request)"
6483
```
6584

6685
### Migrations
@@ -85,13 +104,13 @@ bin/console doctrine:migrations:migrate
85104

86105
## Example of complete CMS Page
87106

88-
### Admin form with preview
107+
### Admin grid
89108

90-
![Admin full form](screenshots/full_back.jpg)
109+
![Admin grid](screenshots/admin-grid.png)
91110

92-
### Front display
111+
### Admin form
93112

94-
![Front full display](screenshots/full_front.jpg)
113+
![Admin form](screenshots/admin-form.png)
95114

96115
## Create custom elements
97116

@@ -100,8 +119,8 @@ In order to do that, you can check the [Rich Editor custom element creation](htt
100119

101120
## SEO Friendly
102121

103-
You can define for every page the meta title, meta description and meta
104-
keywords.
122+
You can define for every page the meta title, meta description, meta
123+
keywords and meta image.
105124

106125
## Troubleshooting
107126

UPGRADE-2.0.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Upgrade from 1.X to 2.X
2+
3+
In the 2.x we changed the route definition for the shop route.
4+
5+
The file `@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/shop.yaml` does not exist anymore.
6+
7+
Update the file `config/routes/monsieurbiz_sylius_cms_page_plugin.yaml` :
8+
9+
```yaml
10+
monsieurbiz_cms_page_admin:
11+
resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/admin.yaml"
12+
prefix: /%sylius_admin.path_name%
13+
14+
# Show page
15+
monsieurbiz_cms_page_show:
16+
path: /{_locale}/{slug}
17+
methods: [GET]
18+
requirements:
19+
slug: .+
20+
_locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
21+
defaults:
22+
_controller: monsieurbiz_cms_page.controller.page::showAction
23+
_sylius:
24+
template: "@MonsieurBizSyliusCmsPagePlugin/shop/page/show.html.twig"
25+
repository:
26+
method: findOneEnabledAndPublishedBySlugAndChannelCode
27+
arguments:
28+
- $slug
29+
- "expr:service('sylius.context.locale').getLocaleCode()"
30+
- "expr:service('sylius.context.channel').getChannel().getCode()"
31+
- "expr:service('monsieurbiz.cms_page.datetime_provider').now()"
32+
condition: "not(context.getPathInfo() matches '`^%sylius.security.api_route%`') and context.checkPageSlug(request)"
33+
```
34+
35+
We upgraded also the [Rich Editor to the 3.0 version](https://github.com/monsieurbiz/SyliusRichEditorPlugin/blob/3.x/UPGRADE-3.0.md).

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
"description": "This plugins allows you to add manage CMS pages using the Rich Editor",
66
"license": "MIT",
77
"require": {
8-
"monsieurbiz/sylius-plus-adapter-plugin": "^1.1",
9-
"monsieurbiz/sylius-media-manager-plugin": "^1.1",
10-
"monsieurbiz/sylius-rich-editor-plugin": "^2.8",
11-
"php": "^8.1",
12-
"sylius/sylius": ">=1.12 <2.0"
8+
"monsieurbiz/sylius-media-manager-plugin": "^2.0",
9+
"monsieurbiz/sylius-rich-editor-plugin": "^3.0",
10+
"php": "^8.2",
11+
"sylius/sylius": "~2.0.0"
1312
},
1413
"require-dev": {
1514
"friendsofphp/php-cs-fixer": "^3.16",
@@ -39,7 +38,7 @@
3938
},
4039
"extra": {
4140
"branch-alias": {
42-
"dev-master": "1.1-dev"
41+
"dev-master": "2.0-dev"
4342
},
4443
"symfony": {
4544
"docker": false,

dist/config/packages/monsieurbiz_sylius_rich_editor_plugin.yaml

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/config/routes/monsieurbiz_sylius_rich_editor_plugin.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

dist/themes/cms-custom-theme/templates/bundles/MonsieurBizSyliusCmsPagePlugin/Shop/Page/show.html.twig

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)