Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-290: Refactor CMS plugin codebase to the Sylius style #529

Merged
merged 72 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f2eecf2
OP-290: Bumped PHP version to ^8.1
jkindly Aug 23, 2024
832fe8b
OP-290: Move instaclick/php-webdriver to require-dev
jkindly Aug 23, 2024
edf0d9b
OP-290: Remove conflicts as there is no more support for Sf 4
jkindly Aug 23, 2024
f700733
OP-290: Improve performance in assigners
jkindly Aug 23, 2024
98b17dd
OP-290: Remove AuthenticationManagerPolyfillPass.php as equivalent ex…
jkindly Aug 26, 2024
61a449f
OP-290: Remove $ from scripts because it makes it difficult to copy a…
jkindly Aug 26, 2024
5799d5e
OP-290: Update installation.md and sitemap.md. Also change suggested …
jkindly Aug 26, 2024
ded6ce3
OP-290: Change namespace from BitBag\SyliusCmsPlugin\ to Sylius\CmsPl…
jkindly Aug 26, 2024
ba8acd1
OP-290: Change prefix from bitbag_ to sylius_
jkindly Aug 27, 2024
0d7ddaa
OP-290: Migration
jkindly Aug 27, 2024
aed0a9a
OP-290: Move ImportFromCsvCommand.php to Console\Command namespace
jkindly Aug 28, 2024
0c97f0a
OP-290: Change of API serialization groups
jkindly Aug 28, 2024
280463a
OP-290: Doctrine query extension to filter api responses
jkindly Aug 28, 2024
1e0aaa0
OP-290: Template controller refactor
jkindly Aug 29, 2024
7f5a343
OP-290: Remove bitbag docblock at the top of files
jkindly Aug 29, 2024
da41c70
OP-290: Remove sitemap info as it does not support sylius 1.13
jkindly Aug 29, 2024
be854f0
OP-290: Move resource definitions to Configuration tree instead of YA…
jkindly Aug 30, 2024
ac5819e
OP-290: change sylius_cms_plugin to sylius_cms and BitBagSyliusCmsPlu…
jkindly Aug 30, 2024
033daa7
OP-290: rename everything related to bitbag, bit_bag etc.
jkindly Sep 2, 2024
8c8e236
OP-290: .env.test update
jkindly Sep 2, 2024
f245fe6
OP-290: tests
jkindly Sep 3, 2024
5b7feaf
OP-290: migration
jkindly Sep 3, 2024
8a02c43
OP-290: phpstan fix
jkindly Sep 3, 2024
8f349b8
OP-290: phpunit fix
jkindly Sep 3, 2024
9dc5802
OP-290: behat fix
jkindly Sep 3, 2024
134c192
OP-290: Bumped PHP version to ^8.1
jkindly Aug 23, 2024
48039f9
OP-290: Move instaclick/php-webdriver to require-dev
jkindly Aug 23, 2024
7dbc1c8
OP-290: Remove conflicts as there is no more support for Sf 4
jkindly Aug 23, 2024
3ae568c
OP-290: Improve performance in assigners
jkindly Aug 23, 2024
a9b5b1e
OP-290: Remove AuthenticationManagerPolyfillPass.php as equivalent ex…
jkindly Aug 26, 2024
48e833a
OP-290: Remove $ from scripts because it makes it difficult to copy a…
jkindly Aug 26, 2024
b2ea87b
OP-290: Update installation.md and sitemap.md. Also change suggested …
jkindly Aug 26, 2024
3912b74
OP-290: Change namespace from BitBag\SyliusCmsPlugin\ to Sylius\CmsPl…
jkindly Aug 26, 2024
c2f0a60
OP-290: Change prefix from bitbag_ to sylius_
jkindly Aug 27, 2024
769ad3e
OP-290: Migration
jkindly Aug 27, 2024
2b908e1
OP-290: Move ImportFromCsvCommand.php to Console\Command namespace
jkindly Aug 28, 2024
d4f718b
OP-290: Change of API serialization groups
jkindly Aug 28, 2024
587e1c0
OP-290: Doctrine query extension to filter api responses
jkindly Aug 28, 2024
e96053d
OP-290: Template controller refactor
jkindly Aug 29, 2024
eba6d53
OP-290: Remove bitbag docblock at the top of files
jkindly Aug 29, 2024
23db299
OP-290: Remove sitemap info as it does not support sylius 1.13
jkindly Aug 29, 2024
24eb2e3
OP-290: Move resource definitions to Configuration tree instead of YA…
jkindly Aug 30, 2024
ffad32b
OP-290: change sylius_cms_plugin to sylius_cms and BitBagSyliusCmsPlu…
jkindly Aug 30, 2024
d9a9e5b
OP-290: rename everything related to bitbag, bit_bag etc.
jkindly Sep 2, 2024
1241adc
OP-290: .env.test update
jkindly Sep 2, 2024
6797e30
OP-290: tests
jkindly Sep 3, 2024
a49ac9d
OP-290: migration
jkindly Sep 3, 2024
9cd5104
OP-290: phpstan fix
jkindly Sep 3, 2024
9f3a359
OP-290: phpunit fix
jkindly Sep 3, 2024
799aab8
OP-290: behat fix
jkindly Sep 3, 2024
33aca3e
OP-290: conflicts resolve
jkindly Sep 4, 2024
ecb3c67
Merge remote-tracking branch 'origin/feature/OP-290' into feature/OP-290
jkindly Sep 4, 2024
1198616
OP-290: unused use statement
jkindly Sep 4, 2024
6646f0f
OP-290: behat fixes
jkindly Sep 4, 2024
c9933c5
Debugging behat scenario
senghe Sep 5, 2024
32f3036
Debugging behat scenario
senghe Sep 5, 2024
2d896c5
Debugging behat scenario
senghe Sep 5, 2024
7b269d2
Debugging behat scenario
senghe Sep 5, 2024
c068095
Debugging behat scenario
senghe Sep 5, 2024
1e6a844
Debugging behat scenario
senghe Sep 5, 2024
327f827
Debugging behat scenario
senghe Sep 5, 2024
a505793
Debugging behat scenario
senghe Sep 5, 2024
ede244d
Debugging behat scenario
senghe Sep 5, 2024
64a4b3e
Debugging behat scenario
senghe Sep 5, 2024
7d69b12
Debugging behat scenario
senghe Sep 5, 2024
6c09b11
Debugging behats
senghe Sep 5, 2024
fa190ca
Debugging behats
senghe Sep 5, 2024
2659221
Debugging behats
senghe Sep 5, 2024
b7a2ee8
Debugging behats
senghe Sep 5, 2024
1ed4717
Debugging behats
senghe Sep 5, 2024
830c68c
OP-290: behat fixes
jkindly Sep 5, 2024
cdb16e7
OP-290: behat fixes
jkindly Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [![](https://bitbag.io/wp-content/uploads/2021/01/CMS.png)](https://bitbag.io/contact-us/?utm_source=github&utm_medium=referral&utm_campaign=plugins_cms)

# BitBag SyliusCMSPlugin
# Sylius CMS Plugin

----

Expand Down
6 changes: 3 additions & 3 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ and [Templates](doc/templates.md) docs.
* Reordered forms/elements for functionality consistency.
* Updated import functionality to work with the new structure.
* Updated fixtures to work with the new structure
* Removed `bitbag_cms_render_product_pages` twig extension.
* Removed `sylius_cms_render_product_pages` twig extension.
* Removed support for rendering twig functions in WYSIWYG editor.
* Added twig extensions:
* `bitbag_cms_render_collection`
* `bitbag_cms_render_content_elements`
* `sylius_cms_render_collection`
* `sylius_cms_render_content_elements`

## Briefly about Content Elements

Expand Down
2 changes: 1 addition & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ structure using `bin/console doctrine:migrations:diff && bin/console doctrine:mi
use raw content in [WYSIWYG editor](doc/wysiwyg.md)
* Chanel awareness has been added to pages, blocks, FAQs, sections and media. That being said, many
repository methods changed their signatures. In case you customized them in your src, check
new signatures in interfaces under [BitBag\SyliusCmsPlugin\Repository](src/Repository) namespace
new signatures in interfaces under [Sylius\CmsPlugin\Repository](src/Repository) namespace
* WYSIWYG editor has been introduced. You will need to import it in your AppKernel and install
its assets. For more, check the [installation guide](doc/installation.md)
* Sitemap support was added, you will need to enable extra bundle in your AppKernel. Read more
Expand Down
2 changes: 1 addition & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ default:
FriendsOfBehat\SymfonyExtension:
bootstrap: tests/Application/config/bootstrap.php
kernel:
class: Tests\BitBag\SyliusCmsPlugin\Application\Kernel
class: Tests\Sylius\CmsPlugin\Application\Kernel

FriendsOfBehat\VariadicExtension: ~

Expand Down
19 changes: 6 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
"description": "CMS plugin for Sylius applications.",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.1",
"sylius/sylius": "^1.12.0 || ^1.13.0",
"league/csv": "^9.1",
"friendsofsymfony/ckeditor-bundle": "^2.0",
"instaclick/php-webdriver": "^1.4",
"symfony/webpack-encore-bundle": "^1.12"
},
"require-dev": {
Expand All @@ -31,6 +30,7 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"instaclick/php-webdriver": "^1.4",
"lchrusciel/api-test-case": "^4.1 || ^5.0",
"matthiasnoback/symfony-config-test": "^5.1",
"phpspec/phpspec": "^7.2",
Expand All @@ -51,26 +51,19 @@
"symfony/runtime": "^5.4 || ^6.4",
"symfony/web-profiler-bundle": "^5.4 || ^6.4"
},
"conflict": {
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8",
"symfony/doctrine-bridge": "4.4.16"
},
"suggest": {
"stefandoorn/sitemap-plugin": "^2.0@alpha"
"stefandoorn/sitemap-plugin": "^2.2"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
"BitBag\\SyliusCmsPlugin\\": "src/",
"Tests\\BitBag\\SyliusCmsPlugin\\": "tests/"
"Sylius\\CmsPlugin\\": "src/",
"Tests\\Sylius\\CmsPlugin\\": "tests/"
}
},
"autoload-dev": {
"psr-4": {
"spec\\BitBag\\SyliusCmsPlugin\\": "spec/"
"spec\\Sylius\\CmsPlugin\\": "spec/"
},
"classmap": ["tests/Application/Kernel.php"]
},
Expand Down
22 changes: 11 additions & 11 deletions doc/01.1-webpack-config.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BitBag SyliusCmsPlugin
# SyliusCmsPlugin

- [⬅️ Back](./installation.md)

Expand All @@ -13,10 +13,10 @@

```js
// webpack.config.js
const [ bitbagCmsShop, bitbagCmsAdmin ] = require('./vendor/bitbag/cms-plugin/webpack.config.js')
const [ cmsShop, cmsAdmin ] = require('./vendor/bitbag/cms-plugin/webpack.config.js')
...

module.exports = [..., bitbagCmsShop, bitbagCmsAdmin];
module.exports = [..., cmsShop, cmsAdmin];
```

2. Add new packages in `./config/packages/assets.yaml`
Expand All @@ -29,9 +29,9 @@ framework:
packages:
# ...
cms_shop:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/cms/shop/manifest.json'
json_manifest_path: '%kernel.project_dir%/public/build/cms/shop/manifest.json'
cms_admin:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/cms/admin/manifest.json'
json_manifest_path: '%kernel.project_dir%/public/build/cms/admin/manifest.json'
```

3. Add new build paths in `./config/packages/webpack_encore.yml`
Expand All @@ -42,24 +42,24 @@ framework:
webpack_encore:
builds:
# ...
cms_shop: '%kernel.project_dir%/public/build/bitbag/cms/shop'
cms_admin: '%kernel.project_dir%/public/build/bitbag/cms/admin'
cms_shop: '%kernel.project_dir%/public/build/cms/shop'
cms_admin: '%kernel.project_dir%/public/build/cms/admin'
```

4. Add encore functions to your templates

```twig
{# @SyliusShopBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cms-shop', null, 'cms_shop') }}
{{ encore_entry_script_tags('sylius-cms-shop', null, 'cms_shop') }}

{# @SyliusShopBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-cms-shop', null, 'cms_shop') }}
{{ encore_entry_link_tags('sylius-cms-shop', null, 'cms_shop') }}

{# @SyliusAdminBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cms-admin', null, 'cms_admin') }}
{{ encore_entry_script_tags('sylius-cms-admin', null, 'cms_admin') }}

{# @SyliusAdminBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-cms-admin', null, 'cms_admin') }}
{{ encore_entry_link_tags('sylius-cms-admin', null, 'cms_admin') }}
```

5. Run `yarn encore dev` or `yarn encore production`
14 changes: 7 additions & 7 deletions doc/01.2-webpack-entry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BitBag SyliusCmsPlugin
# SyliusCmsPlugin

- [⬅️ Back](./installation.md)

Expand All @@ -14,26 +14,26 @@
// ./webpack.config.js

// Shop config
.addEntry('bitbag-cms-shop', 'vendor/bitbag/cms-plugin/src/Resources/assets/shop/entry.js')
.addEntry('sylius-cms-shop', 'vendor/bitbag/cms-plugin/src/Resources/assets/shop/entry.js')

// Admin config
.addEntry('bitbag-cms-admin', 'vendor/bitbag/cms-plugin/src/Resources/assets/admin/entry.js')
.addEntry('sylius-cms-admin', 'vendor/bitbag/cms-plugin/src/Resources/assets/admin/entry.js')
```

2. Add encore functions to your templates

```twig
{# @SyliusShopBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cms-shop', null, 'shop') }}
{{ encore_entry_script_tags('sylius-cms-shop', null, 'shop') }}

{# @SyliusShopBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-cms-shop', null, 'shop') }}
{{ encore_entry_link_tags('sylius-cms-shop', null, 'shop') }}

{# @SyliusAdminBundle/_scripts.html.twig #}
{{ encore_entry_script_tags('bitbag-cms-admin', null, 'admin') }}
{{ encore_entry_script_tags('sylius-cms-admin', null, 'admin') }}

{# @SyliusAdminBundle/_styles.html.twig #}
{{ encore_entry_link_tags('bitbag-cms-admin', null, 'admin') }}
{{ encore_entry_link_tags('sylius-cms-admin', null, 'admin') }}
```

3. Run `yarn encore dev` or `yarn encore production`
2 changes: 1 addition & 1 deletion doc/01.3-import-entry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BitBag SyliusCmsPlugin
# SyliusCmsPlugin

- [⬅️ Back](./installation.md)

Expand Down
2 changes: 1 addition & 1 deletion doc/01.4-custom-solution.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BitBag SyliusCmsPlugin
# SyliusCmsPlugin

- [⬅️ Back](./installation.md)

Expand Down
10 changes: 5 additions & 5 deletions doc/01.5-non-webpack.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BitBag SyliusCmsPlugin
# SyliusCmsPlugin

- [⬅️ Back](./installation.md)

Expand All @@ -20,21 +20,21 @@ $ bin/console assets:install
```twig
{# @SyliusAdminBundle/_scripts.html.twig #}
{% include '@SyliusUi/_javascripts.html.twig' with {
'path': 'bundles/bitbagsyliuscmsplugin/build/bitbag-cms-admin.js'
'path': 'bundles/SyliusCmsPlugin/build/sylius-cms-admin.js'
} %}

{# @SyliusAdminBundle/_styles.html.twig #}
{% include '@SyliusUi/_stylesheets.html.twig' with {
'path': 'bundles/bitbagsyliuscmsplugin/build/bitbag-cms-admin.css'
'path': 'bundles/SyliusCmsPlugin/build/sylius-cms-admin.css'
} %}

{# @SyliusShopBundle/_scripts.html.twig #}
{% include '@SyliusUi/_javascripts.html.twig' with {
'path': 'bundles/bitbagsyliuscmsplugin/build/bitbag-cms-shop.js'
'path': 'bundles/SyliusCmsPlugin/build/sylius-cms-shop.js'
} %}

{# @SyliusShopBundle/_styles.html.twig #}
{% include '@SyliusUi/_stylesheets.html.twig' with {
'path': 'bundles/bitbagsyliuscmsplugin/build/bitbag-cms-shop.css'
'path': 'bundles/SyliusCmsPlugin/build/sylius-cms-shop.css'
} %}
```
16 changes: 8 additions & 8 deletions doc/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Blocks can be placed on the homepage, product page, or any other page of your st

### Rendering the block

In the admin panel, you can create block resources. It could be rendered in your twig templates using `bitbag_cms_render_block([block_code])` helper extension.
In the admin panel, you can create block resources. It could be rendered in your twig templates using `sylius_cms_render_block([block_code])` helper extension.
For instance, let's assume you created a block with `homepage_intro` code and want to render it on store homepage.
In your `app/Resources/views/SyliusShopBundle/Homepage/index.html.twig` file add the Twig filter like this:

Expand All @@ -16,17 +16,17 @@ In your `app/Resources/views/SyliusShopBundle/Homepage/index.html.twig` file add

{% block content %}

{{ bitbag_cms_render_block('homepage_intro') }}
{{ sylius_cms_render_block('homepage_intro') }}

{% endblock %}
```

`{{ bitbag_cms_render_block([block_code]) }}` function can also take two additional parameters: `template` and `context`.
`{{ sylius_cms_render_block([block_code]) }}` function can also take two additional parameters: `template` and `context`.

`template` allows you to render a block with a custom template. For instance:

```twig
{{ bitbag_cms_render_block('homepage_intro', '@App/Some/Template/_path.html.twig') }}
{{ sylius_cms_render_block('homepage_intro', '@App/Some/Template/_path.html.twig') }}
```

`context` allows you to pass additional variables to the block template. It can be one of three types:
Expand All @@ -37,9 +37,9 @@ In your `app/Resources/views/SyliusShopBundle/Homepage/index.html.twig` file add
For instance:

```twig
{{ bitbag_cms_render_block('homepage_intro', null, {'some_variable': 'some_value'}) }}
{{ bitbag_cms_render_block('homepage_intro', null, product) }}
{{ bitbag_cms_render_block('homepage_intro', null, taxon) }}
{{ sylius_cms_render_block('homepage_intro', null, {'some_variable': 'some_value'}) }}
{{ sylius_cms_render_block('homepage_intro', null, product) }}
{{ sylius_cms_render_block('homepage_intro', null, taxon) }}
```

When you pass `ProductInterface` or `TaxonInterface` as a context, the block will be rendered only if it is assigned to the given product or taxon
Expand All @@ -52,5 +52,5 @@ in the admin panel.
If you don't know how to override templates yet,
read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html).

Even if you can pass template argument to render block resource, you can change the global templates under `app/templates/bundles/BitBagSyliusCmsPlugin/Shop/Block` location.
Even if you can pass template argument to render block resource, you can change the global templates under `app/templates/bundles/SyliusCmsPlugin/Shop/Block` location.
Available templates you can override can be found under [this location](../src/Resources/views/Shop/Block).
10 changes: 5 additions & 5 deletions doc/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ Or you might want to group all of your specific blocks together in a collection
### Rendering the collection

In the admin panel, you can create collection resources.
It could be rendered in your twig templates using `bitbag_cms_render_collection([collection_code])` helper extension.
It could be rendered in your twig templates using `sylius_cms_render_collection([collection_code])` helper extension.

`{{ bitbag_cms_render_collection([collection_code]) }}` function can also take two additional parameters: `countToRender` and `template`.
`{{ sylius_cms_render_collection([collection_code]) }}` function can also take two additional parameters: `countToRender` and `template`.

`countToRender` allows you to render a specific number of items from the collection. For instance:

```twig
{{ bitbag_cms_render_collection('homepage_blocks', 3) }}
{{ sylius_cms_render_collection('homepage_blocks', 3) }}
```

`template` allows you to render a collection with a custom template. For instance:

```twig
{{ bitbag_cms_render_collection('homepage_blocks', null, '@App/Some/Template/_path.html.twig') }}
{{ sylius_cms_render_collection('homepage_blocks', null, '@App/Some/Template/_path.html.twig') }}
```

By default, collection items are sorted by object ID parameter. If you want to change it, you can use decorator strategy.
Expand All @@ -35,5 +35,5 @@ You can read more about it [here](https://symfony.com/doc/current/service_contai

If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html).

Even if you can pass template argument to render collection resource, you can change the global templates under `app/templates/bundles/BitBagSyliusCmsPlugin/Shop/Collection` location.
Even if you can pass template argument to render collection resource, you can change the global templates under `app/templates/bundles/SyliusCmsPlugin/Shop/Collection` location.
Available templates you can override can be found under [this location](../src/Resources/views/Shop/Collection).
Loading
Loading