diff --git a/README.md b/README.md index 25008c6c2..82f27f6d3 100755 --- a/README.md +++ b/README.md @@ -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 ---- @@ -30,21 +30,27 @@ Like what we do? Want to join us? Check out our job listings on our [career page *** -Almost every eCommerce app has to present some content. Managing it is often done via third-party libraries like WordPress, eZ Platform, or a built-in content management system. As Sylius does not have a CMS in the standard platform, we decided to develop our own, which will be as flexible as Sylius. This plugin allows you to add dynamic blocks with images, text or HTML to your storefront, as well as pages and FAQs section. - +Almost every eCommerce app has to present some content. Managing it is often done via third-party libraries like WordPress, +eZ Platform, or a built-in content management system. As Sylius does not have a CMS in the standard platform, +we decided to develop our own, which will be as flexible as Sylius. This plugin allows you to add dynamic blocks and pages +with content elements to your storefront. - [Use Case](doc/use_case.md) + - [Collections](doc/use_case_collections.md) + - [Templates](doc/use_case_templates.md) + - [Pages](doc/use_case_pages.md) + - [Blocks](doc/use_case_blocks.md) + - [Media](doc/use_case_media.md) - [Installation](doc/installation.md) - [Upgrading](UPGRADE.md) -- [Blocks](doc/blocks.md) +- [Collections](doc/collections.md) +- [Templates](doc/templates.md) - [Pages](doc/pages.md) -- [Sections](doc/sections.md) +- [Blocks](doc/blocks.md) - [Media](doc/media.md) -- [FAQs](doc/faqs.md) - [Fixtures](doc/fixtures.md) - [WYSIWYG](doc/wysiwyg.md) - [Importing resources](doc/importing-resources.md) -- [Using Twig functions in the admin panel](doc/twig-functions-in-admin.md) - [Sitemap](doc/sitemap.md) - [Customization](doc/customization.md) diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md new file mode 100644 index 000000000..dcd239384 --- /dev/null +++ b/UPGRADE-5.0.md @@ -0,0 +1,105 @@ +# UPGRADE FROM 4.2 TO 5.0 + +This upgrade is a major one, as it introduces a new feature - [Content Elements](doc/content_elements.md) +and removes the old way of creating blocks and pages. + +* A lot of database modifications has been made. Read the below changelog first and then migrate your structure using + `bin/console doctrine:migrations:diff && bin/console doctrine:migrations:migrate` commands. +* Sections are now Collections, as it was a more suitable name for the feature. +* Pages and Blocks now have `Content elements` segment, where you can add elements to the page or block. +* Removed FAQ, as you can now create a FAQ page with the new content elements. +* Added new `Templates` section where you can create templates for your content elements. Read more about it in [Use case templates](doc/use_case_templates.md) +and [Templates](doc/templates.md) docs. +* Removed CKEditor deprecation modal. +* Reordered forms/elements for functionality consistency. +* Updated import functionality to work with the new structure. +* Updated fixtures to work with the new structure +* Removed `sylius_cms_render_product_pages` twig extension. +* Removed support for rendering twig functions in WYSIWYG editor. +* Added twig extensions: + * `sylius_cms_render_collection` + * `sylius_cms_render_content_elements` + +## Briefly about Content Elements + +Content elements is a new segment in the block/page form where you can add elements that will be rendered on the store's frontend, like: +* Textarea +* Heading +* Images +* Products carousel +* etc. + +> Read more about the content elements in the updated [Content elements](doc/content_elements.md) doc. + +## Changes in Collections (old Sections) + +### Added fields: + +* Type +* Pages/Block/Media (depending on the chosen type) + +### Moved fields: + +* Name field has been moved from translations to the main settings tab + +> Read more about the collections in the updated [Use case collections](doc/use_case_collections.md) and [Collections](doc/collections.md) docs. + +## Changes in Pages + +### Removed fields: + +* Products +* Breadcrumb +* Name when linked +* Description when linked +* Image +* Content +* Title + +### Added fields + +* Teaser title +* Teaser content +* Teaser image + +### Moved fields + +* Name field has been moved from translations to the main settings tab + +> Read more about the pages in the updated [Use case pages](doc/use_case_pages.md) and [Pages](doc/pages.md) docs. + +## Changes in Blocks + +### Removed fields: + +* Products +* Taxons +* Whole translations tab + +### Added fields + +* Name +* Locales +* Display for products +* Display for products in taxons +* Display for taxons + +> Read more about the blocks in the updated [Use case blocks](doc/use_case_blocks.md) and [Blocks](doc/blocks.md) docs. + +## Changes in Media + +### Removed fields: + +* Products + +### Added fields + +* Media preview with path + +### Moved fields + +* Name field has been moved from translations to the main settings tab + +### Renamed fields + +* Content -> Link content diff --git a/UPGRADE.md b/UPGRADE.md index 0e3db3428..b04679a0c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -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 diff --git a/behat.yml.dist b/behat.yml.dist index 6c02a541e..b3bfe96cc 100755 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -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: ~ diff --git a/composer.json b/composer.json index 6f32f2416..4d334066f 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -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", @@ -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"] }, diff --git a/doc/01.1-webpack-config.md b/doc/01.1-webpack-config.md index 8f2858c77..5252c5524 100644 --- a/doc/01.1-webpack-config.md +++ b/doc/01.1-webpack-config.md @@ -1,4 +1,4 @@ -# BitBag SyliusCmsPlugin +# SyliusCmsPlugin - [⬅️ Back](./installation.md) @@ -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` @@ -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` @@ -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` diff --git a/doc/01.2-webpack-entry.md b/doc/01.2-webpack-entry.md index 1b05a90af..f9f3bac48 100644 --- a/doc/01.2-webpack-entry.md +++ b/doc/01.2-webpack-entry.md @@ -1,4 +1,4 @@ -# BitBag SyliusCmsPlugin +# SyliusCmsPlugin - [⬅️ Back](./installation.md) @@ -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` diff --git a/doc/01.3-import-entry.md b/doc/01.3-import-entry.md index b9682057b..35d9b0140 100644 --- a/doc/01.3-import-entry.md +++ b/doc/01.3-import-entry.md @@ -1,4 +1,4 @@ -# BitBag SyliusCmsPlugin +# SyliusCmsPlugin - [⬅️ Back](./installation.md) diff --git a/doc/01.4-custom-solution.md b/doc/01.4-custom-solution.md index c8289ce29..a232831f4 100644 --- a/doc/01.4-custom-solution.md +++ b/doc/01.4-custom-solution.md @@ -1,4 +1,4 @@ -# BitBag SyliusCmsPlugin +# SyliusCmsPlugin - [⬅️ Back](./installation.md) diff --git a/doc/01.5-non-webpack.md b/doc/01.5-non-webpack.md index b20d41b1c..174faab67 100644 --- a/doc/01.5-non-webpack.md +++ b/doc/01.5-non-webpack.md @@ -1,4 +1,4 @@ -# BitBag SyliusCmsPlugin +# SyliusCmsPlugin - [⬅️ Back](./installation.md) @@ -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' } %} ``` diff --git a/doc/block_legacy.csv b/doc/block_legacy.csv new file mode 100644 index 000000000..0e592d202 --- /dev/null +++ b/doc/block_legacy.csv @@ -0,0 +1,2 @@ +code,type,name_en_US,content_en_US,sections,channels,products,image_en_US,slug_en_US +test4,image,Test,test,"blog, general",US_WEB,"010ba66b-adee-3d6e-9d63-67c44d686db1, 01d35db9-247d-3834-b300-20483d5e34e8",https://bitbag.shop/assets/web/images/header-logo.png,https://bitbag.shop/assets/web/images/header-logo.png diff --git a/doc/blocks.md b/doc/blocks.md index 7d062162a..bd421f810 100644 --- a/doc/blocks.md +++ b/doc/blocks.md @@ -1,11 +1,13 @@ # Blocks -Blocks represent single parts of your Sylius web app, where you can put some content hardcoded in the -template and change it in the future from admin panel. +Blocks represent single parts of your Sylius web app, where you can put some content elements via the admin panel. +Blocks can be placed on the homepage, product page, or any other page of your store. ## General usage -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. +### Rendering the block + +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: @@ -14,27 +16,41 @@ In your `app/Resources/views/SyliusShopBundle/Homepage/index.html.twig` file add {% block content %} -# The template is not a mandatory parameter +{{ sylius_cms_render_block('homepage_intro') }} -{{ render(path('bitbag_sylius_cms_plugin_shop_block_render', {'code' : 'homepage_header_image', 'template' : '@App/Some/Template/_path.html.twig'})) }} +{% endblock %} +``` -# However, you can pass it to the `bitbag_cms_render_block` function if you wish :) +`{{ sylius_cms_render_block([block_code]) }}` function can also take two additional parameters: `template` and `context`. -{{ bitbag_cms_render_block('homepage_intro') }} +`template` allows you to render a block with a custom template. For instance: -{% endblock %} +```twig +{{ sylius_cms_render_block('homepage_intro', '@App/Some/Template/_path.html.twig') }} ``` -To render a block by the product code, you can use `route`. +`context` allows you to pass additional variables to the block template. It can be one of three types: +- `ProductInterface` +- `TaxonInterface` +- `array` + +For instance: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_block_index_by_product_code', {'productCode' : product.code, 'template' : '@BitBagSyliusCmsPlugin/Shop/Block/index.html.twig'})) }} +{{ 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 +in the admin panel. + ## Customization -If you don't know how to override templates yet, +### Override block template + +If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/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). diff --git a/doc/blocks_cms.png b/doc/blocks_cms.png index 003236f22..eccefadd5 100644 Binary files a/doc/blocks_cms.png and b/doc/blocks_cms.png differ diff --git a/doc/blocks_cms_result.png b/doc/blocks_cms_result.png index ecc5035aa..87c5faca6 100644 Binary files a/doc/blocks_cms_result.png and b/doc/blocks_cms_result.png differ diff --git a/doc/blocks_create_cms.png b/doc/blocks_create_cms.png index 4eca96ca7..e54b375a4 100644 Binary files a/doc/blocks_create_cms.png and b/doc/blocks_create_cms.png differ diff --git a/doc/collections.md b/doc/collections.md new file mode 100644 index 000000000..9f37fc3f3 --- /dev/null +++ b/doc/collections.md @@ -0,0 +1,39 @@ +# Collections + +Collections are a way to group multiple pages, blocks or media together. +They are useful for organizing things in a way that makes sense to you. \ +For example, you might want to group all of your blog posts together in a collection called `Blog`. +Or you might want to group all of your specific blocks together in a collection called `Homepage blocks`. + +## General usage + +### Rendering the collection + +In the admin panel, you can create collection resources. +It could be rendered in your twig templates using `sylius_cms_render_collection([collection_code])` helper extension. + +`{{ 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 +{{ sylius_cms_render_collection('homepage_blocks', 3) }} +``` + +`template` allows you to render a collection with a custom template. For instance: + +```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. +You can read more about it [here](https://symfony.com/doc/current/service_container/service_decoration.html). + +## Customization + +### Override collection template + +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/SyliusCmsPlugin/Shop/Collection` location. +Available templates you can override can be found under [this location](../src/Resources/views/Shop/Collection). diff --git a/doc/collections_cms.png b/doc/collections_cms.png new file mode 100644 index 000000000..3dddb781f Binary files /dev/null and b/doc/collections_cms.png differ diff --git a/doc/collections_cms_result.png b/doc/collections_cms_result.png new file mode 100644 index 000000000..c96ecfdb2 Binary files /dev/null and b/doc/collections_cms_result.png differ diff --git a/doc/collections_create_cms.png b/doc/collections_create_cms.png new file mode 100644 index 000000000..13cc513c5 Binary files /dev/null and b/doc/collections_create_cms.png differ diff --git a/doc/content_elements.md b/doc/content_elements.md new file mode 100644 index 000000000..8c75730af --- /dev/null +++ b/doc/content_elements.md @@ -0,0 +1,128 @@ +# Content elements + +Content elements are used to create a page or block content that will be displayed on the store's frontend. + +## General usage + +Currently, there are 11 predefined content elements available: +- **[Textarea](content_elements/textarea.md)** - a simple textarea with WYSIWYG editor +- **[Single media](content_elements/single_media.md)** - a single media from the media library +- **[Multiple media](content_elements/multiple_media.md)** - multiple media from the media library +- **[Heading](content_elements/heading.md)** - a simple heading from h1 to h6 +- **[Products carousel](content_elements/products_carousel.md)** - a carousel with products +- **[Products carousel by Taxon](content_elements/products_carousel_by_taxon.md)** - a carousel with products from a specific taxon +- **[Products grid](content_elements/products_grid.md)** - a grid with products +- **[Products grid by Taxon](content_elements/products_grid_by_taxon.md)** - a grid with products from a specific taxon +- **[Taxons list](content_elements/taxons_list.md)** - a list of taxons +- **[Pages collection](content_elements/pages_collection.md)** - a collection of pages +- **[Spacer](content_elements/spacer.md)** - a simple spacer with a defined height in pixels + +Instead of rendering block or page, you can render just content elements in your twig templates using `sylius_cms_render_content_elements([page|block])` helper extension, +where `page` or `block` is an instance of `Sylius\CmsPlugin\Entity\PageInterface` or `Sylius\CmsPlugin\Entity\BlockInterface`. + +## Customization + +### Templates + +Each of the content elements has its own template that you can override. + +If you don't know how to override templates yet, +read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). + +You can create a template under `app/templates/bundles/SyliusCmsPlugin/Shop/ContentElement` location. +Available templates you can override can be found under [this location](../src/Resources/views/Shop/ContentElement). + +### Creating a new content element + +If you want to create a new content element, you need to follow these steps: + +1. Create a new form type under `src/Form/Type/ContentElements` location. Define your fields and remember to define public const `TYPE` with a unique name. +For example, you can create a new form type called `Text`: + +```php +final class TextContentElementType extends AbstractType +{ + public const TYPE = 'text'; + + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add(self::TYPE, TextType::class, [ + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, + ]) + ; + } +} +``` + +2. If your form type have constructor with some arguments, define constant parameter in `config/parameters.yaml` or yours any other `yaml` file: + +```yaml +parameters: + sylius_cms.content_elements.type.text: !php/const 'YourNamespace\Form\Type\ContentElements\TextContentElementType::TYPE' +``` + +If your form type doesn't have any constructor arguments, you can skip this step, because compiler pass will automatically define it for you. + + +3. If your form type have constructor with some arguments, you must define form type in service container under `config/services.yml` with correct tags: + +```yaml +services: + sylius_cms.form.type.content_element.text: + class: YourNamespace\Form\Type\ContentElements\TextContentElementType + arguments: [...] + tags: + - { name: 'sylius_cms.content_elements.type', key: '%sylius_cms.content_elements.type.text%' } + - { name: 'form.type' } +``` + +If your form type doesn't have any constructor arguments, you can skip this step, because compiler pass will automatically register it for you. + +4. Create a new renderer class under `src/Renderer/ContentElement` location. Extend `Sylius\CmsPlugin\Renderer\ContentElement\AbstractContentElement` class. +For example, you can create a new renderer called `TextContentElementRenderer`: + +```php +final class TextContentElementRenderer extends AbstractContentElement +{ + public function supports(ContentConfigurationInterface $contentConfiguration): bool + { + return TextContentElementType::TYPE === $contentConfiguration->getType(); + } + + public function render(ContentConfigurationInterface $contentConfiguration): string + { + $text = $contentConfiguration->getConfiguration()['text']; + + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, + 'text' => $text, + ]); + } +} +``` + +5. Register your renderer with tag in service container under `config/services.yml`: + +```yaml +services: + sylius_cms.renderer.content_element.text: + class: YourNamespace\Renderer\ContentElement\TextContentElementRenderer + arguments: + - '@twig' + tags: + - { + name: 'sylius_cms.renderer.content_element', + template: '@YourNamespace/Shop/ContentElement/_text.html.twig', + form_type: 'YourNamespace\Form\Type\ContentElements\TextContentElementType' + } +``` + +Define form_type only if your form type doesn't have constructor with additional arguments. + +6. Finally, create a new template under `templates/bundles/SyliusCmsPlugin/Shop/ContentElement` location. +For example, you can create a new template called `_text.html.twig`: + +```twig +

{{ text }}

+``` diff --git a/doc/content_elements/heading.md b/doc/content_elements/heading.md new file mode 100644 index 000000000..a82a67b03 --- /dev/null +++ b/doc/content_elements/heading.md @@ -0,0 +1,11 @@ +# Heading content element + +Heading content element allows you to add a heading (from H1 to H6) to your block or page. + +## View in admin panel + +![Heading in admin panel](heading1.png) + +## View in front page + +![Heading in front page](heading2.png) diff --git a/doc/content_elements/heading1.png b/doc/content_elements/heading1.png new file mode 100644 index 000000000..baa1ce118 Binary files /dev/null and b/doc/content_elements/heading1.png differ diff --git a/doc/content_elements/heading2.png b/doc/content_elements/heading2.png new file mode 100644 index 000000000..bf7678611 Binary files /dev/null and b/doc/content_elements/heading2.png differ diff --git a/doc/content_elements/multiple_media.md b/doc/content_elements/multiple_media.md new file mode 100644 index 000000000..92cb2c7df --- /dev/null +++ b/doc/content_elements/multiple_media.md @@ -0,0 +1,12 @@ +# Multiple media content element + +Multiple media content element allows you to add multiple media (images, videos, or files) +from the media library to your block or page. + +## View in admin panel + +![Multiple media in admin panel](multiple_media1.png) + +## View in front page + +![Multiple media in front page](multiple_media2.png) diff --git a/doc/content_elements/multiple_media1.png b/doc/content_elements/multiple_media1.png new file mode 100644 index 000000000..f65db2a59 Binary files /dev/null and b/doc/content_elements/multiple_media1.png differ diff --git a/doc/content_elements/multiple_media2.png b/doc/content_elements/multiple_media2.png new file mode 100644 index 000000000..7630818c6 Binary files /dev/null and b/doc/content_elements/multiple_media2.png differ diff --git a/doc/content_elements/pages_collection.md b/doc/content_elements/pages_collection.md new file mode 100644 index 000000000..8213a6854 --- /dev/null +++ b/doc/content_elements/pages_collection.md @@ -0,0 +1,11 @@ +# Pages collection content element + +Pages collection content element renders a pages from a selected collection. + +## View in admin panel + +![Pages collection in admin panel](pages_collection1.png) + +## View in front page + +![Pages collection in front page](pages_collection2.png) diff --git a/doc/content_elements/pages_collection1.png b/doc/content_elements/pages_collection1.png new file mode 100644 index 000000000..6d1772cbf Binary files /dev/null and b/doc/content_elements/pages_collection1.png differ diff --git a/doc/content_elements/pages_collection2.png b/doc/content_elements/pages_collection2.png new file mode 100644 index 000000000..4f313f905 Binary files /dev/null and b/doc/content_elements/pages_collection2.png differ diff --git a/doc/content_elements/products_carousel.md b/doc/content_elements/products_carousel.md new file mode 100644 index 000000000..dfee37309 --- /dev/null +++ b/doc/content_elements/products_carousel.md @@ -0,0 +1,11 @@ +# Products carousel content element + +Products carousel content element allows you to add a carousel with shop products to your block or page. + +## View in admin panel + +![Products carousel in admin panel](products_carousel1.png) + +## View in front page + +![Products carousel in front page](products_carousel2.png) diff --git a/doc/content_elements/products_carousel1.png b/doc/content_elements/products_carousel1.png new file mode 100644 index 000000000..56438a64d Binary files /dev/null and b/doc/content_elements/products_carousel1.png differ diff --git a/doc/content_elements/products_carousel2.png b/doc/content_elements/products_carousel2.png new file mode 100644 index 000000000..1eefc60c9 Binary files /dev/null and b/doc/content_elements/products_carousel2.png differ diff --git a/doc/content_elements/products_carousel_by_taxon.md b/doc/content_elements/products_carousel_by_taxon.md new file mode 100644 index 000000000..9acb0078e --- /dev/null +++ b/doc/content_elements/products_carousel_by_taxon.md @@ -0,0 +1,12 @@ +# Products carousel by Taxon content element + +Products carousel by Taxon content element allows you to add a carousel +with shop products from specified taxon to your block or page. + +## View in admin panel + +![Products carousel by Taxon in admin panel](products_carousel_by_taxon1.png) + +## View in front page + +![Products carousel by Taxon in front page](products_carousel2.png) diff --git a/doc/content_elements/products_carousel_by_taxon1.png b/doc/content_elements/products_carousel_by_taxon1.png new file mode 100644 index 000000000..9683f78b1 Binary files /dev/null and b/doc/content_elements/products_carousel_by_taxon1.png differ diff --git a/doc/content_elements/products_grid.md b/doc/content_elements/products_grid.md new file mode 100644 index 000000000..efe77aae6 --- /dev/null +++ b/doc/content_elements/products_grid.md @@ -0,0 +1,12 @@ +# Products grid content element + +Products grid content element allows you to add a grid with +shop products to your block or page. + +## View in admin panel + +![Products grid in admin panel](products_grid1.png) + +## View in front page + +![Products grid in front page](products_grid2.png) diff --git a/doc/content_elements/products_grid1.png b/doc/content_elements/products_grid1.png new file mode 100644 index 000000000..48b4e1973 Binary files /dev/null and b/doc/content_elements/products_grid1.png differ diff --git a/doc/content_elements/products_grid2.png b/doc/content_elements/products_grid2.png new file mode 100644 index 000000000..57374aeb3 Binary files /dev/null and b/doc/content_elements/products_grid2.png differ diff --git a/doc/content_elements/products_grid_by_taxon.md b/doc/content_elements/products_grid_by_taxon.md new file mode 100644 index 000000000..9cccd08b8 --- /dev/null +++ b/doc/content_elements/products_grid_by_taxon.md @@ -0,0 +1,12 @@ +# Products grid by Taxon content element + +Products grid by Taxon content element allows you to add a grid +with shop products from specified taxon to your block or page. + +## View in admin panel + +![Products grid by Taxon in admin panel](products_grid_by_taxon1.png) + +## View in front page + +![Products grid by Taxon in front page](products_grid2.png) diff --git a/doc/content_elements/products_grid_by_taxon1.png b/doc/content_elements/products_grid_by_taxon1.png new file mode 100644 index 000000000..2deae902b Binary files /dev/null and b/doc/content_elements/products_grid_by_taxon1.png differ diff --git a/doc/content_elements/single_media.md b/doc/content_elements/single_media.md new file mode 100644 index 000000000..03386d056 --- /dev/null +++ b/doc/content_elements/single_media.md @@ -0,0 +1,12 @@ +# Single media content element + +Single media content element allows you to add a single media (image, video, or file) +from the media library to your block or page. + +## View in admin panel + +![Single media in admin panel](single_media1.png) + +## View in front page + +![Single media in front page](single_media2.png) diff --git a/doc/content_elements/single_media1.png b/doc/content_elements/single_media1.png new file mode 100644 index 000000000..35009ed5d Binary files /dev/null and b/doc/content_elements/single_media1.png differ diff --git a/doc/content_elements/single_media2.png b/doc/content_elements/single_media2.png new file mode 100644 index 000000000..d21dfb69c Binary files /dev/null and b/doc/content_elements/single_media2.png differ diff --git a/doc/content_elements/spacer.md b/doc/content_elements/spacer.md new file mode 100644 index 000000000..526ddf0ac --- /dev/null +++ b/doc/content_elements/spacer.md @@ -0,0 +1,12 @@ +# Spacer content element + +Spacer content element allows you to add a space in pixels +between content elements to your block or page. + +## View in admin panel + +![Spacer in admin panel](spacer1.png) + +## View in front page + +![Spacer in front page](spacer2.png) diff --git a/doc/content_elements/spacer1.png b/doc/content_elements/spacer1.png new file mode 100644 index 000000000..4dc49e262 Binary files /dev/null and b/doc/content_elements/spacer1.png differ diff --git a/doc/content_elements/spacer2.png b/doc/content_elements/spacer2.png new file mode 100644 index 000000000..99dfd6c6c Binary files /dev/null and b/doc/content_elements/spacer2.png differ diff --git a/doc/content_elements/taxons_list.md b/doc/content_elements/taxons_list.md new file mode 100644 index 000000000..e74952287 --- /dev/null +++ b/doc/content_elements/taxons_list.md @@ -0,0 +1,12 @@ +# Taxons list content element + +Taxons list content element allows you to add a list of taxons +to your block or page. + +## View in admin panel + +![Taxons list in admin panel](taxons_list1.png) + +## View in front page + +![Taxons list in front page](taxons_list2.png) diff --git a/doc/content_elements/taxons_list1.png b/doc/content_elements/taxons_list1.png new file mode 100644 index 000000000..cae575202 Binary files /dev/null and b/doc/content_elements/taxons_list1.png differ diff --git a/doc/content_elements/taxons_list2.png b/doc/content_elements/taxons_list2.png new file mode 100644 index 000000000..04e34a0a8 Binary files /dev/null and b/doc/content_elements/taxons_list2.png differ diff --git a/doc/content_elements/textarea.md b/doc/content_elements/textarea.md new file mode 100644 index 000000000..413ac41cf --- /dev/null +++ b/doc/content_elements/textarea.md @@ -0,0 +1,12 @@ +# Textarea content element + +Textarea content element allows you to add a simple text area to your block or page +with WYSIWYG editor (CKEditor). + +## View in admin panel + +![Textarea in admin panel](textarea1.png) + +## View in front page + +![Textarea in front page](textarea2.png) diff --git a/doc/content_elements/textarea1.png b/doc/content_elements/textarea1.png new file mode 100644 index 000000000..50f56a4fa Binary files /dev/null and b/doc/content_elements/textarea1.png differ diff --git a/doc/content_elements/textarea2.png b/doc/content_elements/textarea2.png new file mode 100644 index 000000000..aba0bd2e9 Binary files /dev/null and b/doc/content_elements/textarea2.png differ diff --git a/doc/content_management.png b/doc/content_management.png index a3136ee59..910efa9b0 100644 Binary files a/doc/content_management.png and b/doc/content_management.png differ diff --git a/doc/customization.md b/doc/customization.md index e5e398d9c..f73654d61 100644 --- a/doc/customization.md +++ b/doc/customization.md @@ -9,34 +9,34 @@ You can customize this plugin using: In order to check what services are available with this plugin, run the following command: ```bash -$ bin/console debug:container bitbag_sylius_cms_plugin +$ bin/console debug:container sylius_cms ``` **Note:** -*All forms are prefixed with 'bitbag_sylius_cms_plugin.form.*'* +*All forms are prefixed with 'sylius_cms.form.*'* If you want to check what routes are available with this plugin, use: ```bash -$ bin/console debug:router | grep bitbag_sylius_cms_plugin +$ bin/console debug:router | grep sylius_cms ``` To check parameters available with the plugin, execute: ```bash -$ bin/console debug:container --parameters | grep bitbag +$ bin/console debug:container --parameters | grep sylius_cms ``` ## How to disable localised URLs? -Customise vendor routing in the file `app/Resources/BitBagSyliusCmsPlugin/config/routing.yml` (create if not exist). +Customise vendor routing in the file `app/Resources/SyliusCmsPlugin/config/routing.yml` (create if not exist). Add: ``` -bitbag_sylius_cms_plugin_admin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin.yml" +sylius_cms_admin: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin.yml" prefix: /admin -bitbag_sylius_cms_plugin_shop: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop.yml" +sylius_cms_shop: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop.yml" prefix: / sylius_sitemap: diff --git a/doc/fixtures.md b/doc/fixtures.md index 5b3d2c191..c4cc0a82f 100644 --- a/doc/fixtures.md +++ b/doc/fixtures.md @@ -9,4 +9,4 @@ read [this documentation page](http://docs.sylius.com/en/1.2/book/architecture/f ## General usage -As you can see in [here](../tests/Application/config/packages/bitbag_sylius_cms_plugin.yml), cms fixtures are configured to be run under `default` suite. It means that after installing plugin all you need to do is run `bin/console sylius:fixtures:load` and all of cms fixtures will load as well. +As you can see in [here](../tests/Application/config/packages/sylius_cms.yml), cms fixtures are configured to be run under `default` suite. It means that after installing plugin all you need to do is run `bin/console sylius:fixtures:load` and all of cms fixtures will load as well. diff --git a/doc/importing-resources.md b/doc/importing-resources.md index 8cce460a4..0e8d0e696 100644 --- a/doc/importing-resources.md +++ b/doc/importing-resources.md @@ -21,10 +21,9 @@ are validated against constraints used in the admin panel. What's more, thanks t Currently implemented importers support following column names, which are constants values from below table. **Note:** -- `__locale__` suffix needs to be replaced with a specific locale configured in your admin panel. -- `sections`, `channels` and `products` represent associations that are recognized with comma separated resource codes. -For instance, if you want to associate three sections via the CSV file, you should fill the `sections` column with -`homepage, blog, delivery` value, where each value is a single section code. +- `collections`, `channels`, `locales`, `products`, `products_in_taxons`, `taxons` represent associations that are recognized with comma separated resource codes. +For instance, if you want to associate three collections via the CSV file, you should fill the `collections` column with +`homepage, blog, delivery` value, where each value is a single collection code. | Resource code | Importer columns interface | |---------------|--------------------------------------------------------------------| @@ -39,13 +38,13 @@ As previously mentioned, in order to import a data, you need to pick specific re In order to import data via command, execute: ```bash -$ bin/console bitbag:import:csv [resource code] [path/to/your/csv/file.csv] +$ bin/console cms:import:csv [resource code] [path/to/your/csv/file.csv] ``` For instance, if you wish to import a page, run: ```bash -$ bin/console bitbag:import:csv page ~/Documents/pages.csv +$ bin/console cms:import:csv page ~/Documents/pages.csv ``` ## Importing via admin panel @@ -64,7 +63,7 @@ the resolver needs to create a new resource or update an existing one: ```yaml app.resolver.resource.product: - class: BitBag\SyliusCmsPlugin\Resolver\ResourceResolver + class: Sylius\CmsPlugin\Resolver\ResourceResolver arguments: - "@sylius.repository.product" - "@sylius.factory.product" @@ -80,7 +79,7 @@ declare(strict_types=1); namespace AppBundle\Importer; -use BitBag\SyliusCmsPlugin\Importer\ImporterInterface; +use Sylius\CmsPlugin\Importer\ImporterInterface; interface ProductImporterInterface extends ImporterInterface { @@ -100,8 +99,8 @@ declare(strict_types=1); namespace AppBundle\Importer; -use BitBag\SyliusCmsPlugin\Importer\AbstractImporter; -use BitBag\SyliusCmsPlugin\Resolver\ResourceResolverInterface; +use Sylius\CmsPlugin\Importer\AbstractImporter; +use Sylius\CmsPlugin\Resolver\ResourceResolverInterface; use Doctrine\ORM\EntityManagerInterface; use Sylius\Component\Locale\Context\LocaleContextInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -181,12 +180,12 @@ final class ProductImporter extends AbstractImporter implements ProductImporterI - "@validator" - "@doctrine.orm.entity_manager" tags: - - { name: bitbag.cmsplugin.importer } + - { name: cms_plugin.importer } ``` 5. :tada: -Now you can use the `$ bin/console bitbag:import:csv product /path/to/products.csv/file` command to upload your products. +Now you can use the `$ bin/console cms:import:csv product /path/to/products.csv/file` command to upload your products. Read the below section to enable the import from UI feature. @@ -213,7 +212,7 @@ sylius_grid: ### Overriding the importer grid template -Create an `_importForm.html.twig` file under `app/Resources/BitBagSyliusCmsPlugin/views/Grid/Form` location. Take a look at +Create an `_importForm.html.twig` file under `app/Resources/SyliusCmsPlugin/views/Grid/Form` location. Take a look at the default [_importForm.html.twig](../src/Resources/views/Grid/Form/_importForm.html.twig) file. ### Example diff --git a/doc/installation.md b/doc/installation.md index 842b00618..6ae5939f9 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -4,36 +4,35 @@ 1. *We work on stable, supported and up-to-date versions of packages. We recommend you to do the same.* ```bash -$ composer require bitbag/cms-plugin --no-scripts +composer require bitbag/cms-plugin --no-scripts ``` -2. Add plugin dependencies to your `config/bundles.php` file: +2. Add plugin dependencies to your `config/bundles.php` file (if not added automatically): ```php return [ ... FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], // WYSIWYG editor - BitBag\SyliusCmsPlugin\BitBagSyliusCmsPlugin::class => ['all' => true], + Sylius\CmsPlugin\SyliusCmsPlugin::class => ['all' => true], ]; ``` -The first line above (FOSCKEditorBundle) might have been already added during composer require command. -Install WYSIWYG editor ([FOS CKEditor](https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/ckeditor.html)) +3. Install WYSIWYG editor ([FOS CKEditor](https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/ckeditor.html)) ```bash -$ bin/console ckeditor:install +bin/console ckeditor:install ``` **Note.** If you have an issue with the ckeditor not running, please try to install it using the `4.22.1` tag: ```bash -$ bin/console ckeditor:install --tag=4.22.1 +bin/console ckeditor:install --tag=4.22.1 ``` For more information regardin `4.22.1` tag please visit the #485 issue. -Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must add some configuration under the `twig.form_themes` config key: +#### If you are not using Symfony Flex, you need to add the following configuration under the `twig.form_themes` config key: ```yaml # Symfony 2/3: app/config/config.yml @@ -42,69 +41,38 @@ Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must ad twig: form_themes: - '@FOSCKEditor/Form/ckeditor_widget.html.twig' - - '@BitBagSyliusCmsPlugin/Form/ckeditor_widget.html.twig' + - '@SyliusCmsPlugin/Form/ckeditor_widget.html.twig' ``` -3. Import required config in your `config/packages/_sylius.yaml` file: +4. If you are not using Symfony Flex, import add following configs: ```yaml # config/packages/_sylius.yaml imports: ... - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/config.yml" } -``` - -4. Import routing in your `config/routes.yaml` file: + - { resource: "@SyliusCmsPlugin/Resources/config/config.yml" } -```yaml # config/routes.yaml ... -bitbag_sylius_cms_plugin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing.yml" -``` -If You have installed https://github.com/stefandoorn/sitemap-plugin according to its installation instructions -import optional sitemap providers: -```yaml -# config/services.yaml -... -imports: -... - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/services/sitemap_provider.yml" } -``` - -and plugin dependency to your `config/bundles.php` file: -```php -return [ - ... - - SitemapPlugin\SitemapPlugin::class => ['all' => true], // Sitemap support -]; -``` - -you will probably need to change the extension of the imported file in - -```yaml -# config/packages/sitemap_plugin.yaml - - imports: - - { resource: "@SitemapPlugin/Resources/config/config.yaml" } +sylius_cms: + resource: "@SyliusCmsPlugin/Resources/config/routing.yml" ``` 5. Finish the installation by updating the database schema and installing assets: ```bash -$ bin/console cache:clear +bin/console cache:clear # If you used migrations in your project... -$ bin/console doctrine:migrations:migrate +bin/console doctrine:migrations:migrate # ... or if you use doctrine schema tool. -$ bin/cosole doctrine:schema:update --dump-sql # and --force switch when you're ready :) +bin/cosole doctrine:schema:update --dump-sql # and --force switch when you're ready :) -$ bin/console assets:install --symlink -$ bin/console sylius:theme:assets:install --symlink +bin/console assets:install --symlink +bin/console sylius:theme:assets:install --symlink ``` Note. In some cases the `--symlink` option [may trow some errors](https://github.com/Sylius/SyliusThemeBundle/issues/91). If you consider running the commands without `--symlink` option, please keep in mind to run them on every potential plugin update. @@ -114,48 +82,28 @@ Note. In some cases the `--symlink` option [may trow some errors](https://github We recommend you to use Webpack (Encore), for which we have prepared four different instructions on how to add this plugin's assets to your project: - [Import webpack config](./01.1-webpack-config.md)* -- [Add entry to existing config](./01.2-webpack-entry.md)) -- [Import entries in your entry.js files](./01.3-import-entry.md)) -- [Your own custom config](./01.4-custom-solution.md)) +- [Add entry to existing config](./01.2-webpack-entry.md) +- [Import entries in your entry.js files](./01.3-import-entry.md) +- [Your own custom config](./01.4-custom-solution.md) * Default option for plugin development However, if you are not using Webpack, here are instructions on how to add optimized and compressed assets directly to your project templates: -- [Non webpack solution](./01.5-non-webpack.md) - -7. Passing required "backend" values to "frontend" - -In order to make plugin finally work you need to declare "route", in admin _scripts.html.twig you can pass: - -``` - -``` - -Any other approach, that will allow cms pages to read this value in js, under "route" key, will work. +- [Non webpack solution](./01.5-non-webpack.md) ## Testing & running the plugin ```bash -$ composer install -$ cd tests/Application -``` -Copy file `package.json.~1.XX.0.dist` to `package.json` where `~1.XX.0` is the Sylius version you are using. - -```bash -$ cp package.json.~1.12.0.dist package.json -``` - -```bash -$ yarn install -$ yarn encore dev -$ APP_ENV=test bin/console assets:install -$ APP_ENV=test bin/console doctrine:schema:create -$ APP_ENV=test symfony server:start --port=8080 -d -$ cd ../.. -$ open http://localhost:8080 -$ vendor/bin/behat -$ vendor/bin/phpspec run +composer install +cd tests/Application +yarn install +yarn encore dev +APP_ENV=test bin/console assets:install +APP_ENV=test bin/console doctrine:schema:create +APP_ENV=test symfony server:start --port=8080 -d +cd ../.. +open http://localhost:8080 +vendor/bin/behat +vendor/bin/phpspec run ``` diff --git a/doc/legacy_data_migration.md b/doc/legacy_data_migration.md new file mode 100644 index 000000000..4ee2ce364 --- /dev/null +++ b/doc/legacy_data_migration.md @@ -0,0 +1,49 @@ +# Legacy data migration + +## Introduction + +You can migrate your blocks & pages from the 4.x version to the 5.x version of the plugin. +To do so, you need to follow the steps below. + +## Steps + +1. Create new CSV files with blocks & pages data in the 4.x format. +See an example in [block_legacy.csv](block_legacy.csv) or [page_legacy.csv](page_legacy.csv). +2. Install the 5.x version of the plugin. +3. Go to the console and run the following command: +```bash +bin/console cms:import:csv page_legacy {file_path}.csv +bin/console cms:import:csv block_legacy {file_path}.csv +``` + +## Info about legacy CSV files columns + +### Blocks + +- **code** - block code. +- **type** - it will be ignored. +- **name_LOCALE** - block name. First occurrence of its column is the default name for the block. +For each locale, there will be created a Heading content element. +- **content_LOCALE** - block content. For each locale, there will be created a Textarea content element. +- **sections** - it will be converted to the block's collections. +- **channels** - block channels. +- **products** - block products. There will be created Products grid content element. +- **image_LOCALE** - block image. For each locale, there will be created a Single media content element. +- **slug_LOCALE** - it will be ignored. + +### Pages + +- **code** - page code. +- **sections** - it will be converted to the page's collections. +- **channels** - page channels. +- **products** - page products. There will be created Products grid content element. +- **slug_LOCALE** - page slug. +- **name_LOCALE** - page name. First occurrence of its column is the default name for the page. +For each locale, there will be created a Heading content element. +- **image_LOCALE** - page image. For each locale, there will be created a Single media content element. +- **meta_keywords_LOCALE** - page meta keywords. +- **meta_description_LOCALE** - page meta description. +- **content_LOCALE** - page content. For each locale, there will be created a Textarea content element. +- **breadcrumb_LOCALE** - it will be ignored. +- **name_when_linked_LOCALE** - for each locale, there will be created a teaser title. +- **description_when_linked_LOCALE** - for each locale, there will be created a teaser content. diff --git a/doc/media.md b/doc/media.md index 542508321..ebd781ae2 100644 --- a/doc/media.md +++ b/doc/media.md @@ -10,50 +10,45 @@ Currently, it supports following media types: ## General usage -You can render media in four ways: +You can render media in two ways: By rendering a media code template: ```twig -{{ bitbag_cms_render_media('media_code') }} +{{ sylius_cms_render_media('media_code') }} ``` - -Rendering a media code directly: +Function above can also take an additional parameter: `template`. ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_media_render', {'code' : 'file', 'template' : '@App/Some/Template/_path.html.twig'})) }} +{{ sylius_cms_render_media('media_code', '@App/templates/example.html.twig')}} ``` -If you want to list media by specific section. Useful for displaying set of images. For example, using "gallery" section you can group set of images and display them as gallery, or even slider. +Rendering a media code directly: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_media_index_by_section_code', {'sectionCode' : 'gallery', 'template' : '@App/Some/Template/_path.html.twig'})) }} +{{ render(path('sylius_cms_shop_media_render', {'code' : 'file', 'template' : '@App/Some/Template/_path.html.twig'})) }} ``` -Or by providing custom twig template. Useful when you want to render media in a different template: +## Media provider -```{{ bitbag_cms_render_media('media_code', '@App/templates/example.html.twig')}}``` +You can add your own media provider by adding a service with a tag named `sylius_cms.media_provider`: -### Media provider - -You can add your own media provider by adding a service with a tag named `bitbag_sylius_cms_plugin.media_provider`: - -```php +```twig app.media_provider.audio: - class: BitBag\SyliusCmsPlugin\MediaProvider\GenericProvider + class: Sylius\CmsPlugin\MediaProvider\GenericProvider arguments: - - "@bitbag_sylius_cms_plugin.media_uploader" + - "@sylius_cms.media_uploader" - "@templating.engine.twig" - - "@@BitBagSyliusCmsPlugin/Shop/Media/Show/audio.html.twig" + - "@@SyliusCmsPlugin/Shop/Media/Show/audio.html.twig" - "media/audio" tags: - - { name: bitbag_sylius_cms_plugin.media_provider, type: audio, label: bitbag_sylius_cms_plugin.ui.audio_provider } + - { name: sylius_cms.media_provider, type: audio, label: sylius_cms.ui.audio_provider } ``` ## Customization -If you don't know how to override templates yet, +If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/Shop/Media` location. +Even if you can pass template argument to render media resource, you can change the global templates under `app/templates/bundles/SyliusCmsPlugin/Shop/Media` location. Available templates you can override can be found under [this location](../src/Resources/views/Shop/Media). diff --git a/doc/media_cms.png b/doc/media_cms.png index d5edbe354..e2318bec2 100644 Binary files a/doc/media_cms.png and b/doc/media_cms.png differ diff --git a/doc/media_cms_result.png b/doc/media_cms_result.png index c0767e15b..fe6808d97 100644 Binary files a/doc/media_cms_result.png and b/doc/media_cms_result.png differ diff --git a/doc/media_create_cms.png b/doc/media_create_cms.png index 32aaa25bc..63f049ec4 100644 Binary files a/doc/media_create_cms.png and b/doc/media_create_cms.png differ diff --git a/doc/page_legacy.csv b/doc/page_legacy.csv new file mode 100644 index 000000000..47d208dd7 --- /dev/null +++ b/doc/page_legacy.csv @@ -0,0 +1,2 @@ +code,sections,channels,products,slug_en_US,name_en_US,image_en_US,meta_keywords_en_US,meta_description_en_US,content_en_US,breadcrumb_en_US,name_when_linked_en_US,description_when_linked_en_US +aboutUS,,US_WEB,,about_us,About US,,About US,About US,"",,, diff --git a/doc/pages.md b/doc/pages.md index 6ecac44b1..8c407cd5b 100644 --- a/doc/pages.md +++ b/doc/pages.md @@ -1,69 +1,43 @@ # Pages -Pages represent a customizable web page, you can adjust to your needs in admin panel. +Pages represent a customizable web page, you can adjust to your needs in admin panel. + +## Page sections + +Page contain 4 main editable sections: +- **General settings** - where you can set page name, code, channels, collections and publish at. It also contains a Preview button, which allows you to preview the page. +- **Content elements** - where you can add content elements to the page, read more about content elements [here](content_elements.md). +- **Teaser** - where you can set image, title and content. Teaser is a small preview of the page. It is used during rendering a collection of pages. +- **SEO** - where you can set slug, meta title, meta keywords and meta description. ## General usage +### Rendering the page + Once you created a page in the admin panel, you can render page in two ways: By rendering a page link template: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_page_show_link_by_code', {'code' : 'about', 'template' : '@BitBagSyliusCmsPlugin/Shop/Page/Show/_link.html.twig'})) }} +{{ render(path('sylius_cms_shop_page_show_link_by_code', {'code' : 'about', 'template' : '@SyliusCmsPlugin/Shop/Page/Show/_link.html.twig'})) }} ``` Or rendering a page link directly: ```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_page_show', {'slug' : 'about'})) }} -``` - -### Render product pages by section - -Let's assume you associated pages to specific products. You can render them grouped by section in your product view by using - -```twig -{{ bitbag_cms_render_product_pages(product) }} -``` - -Twig function. This is where `nameWhenLinked` and `descriptionWhenLinked` fields are used. If you associate pages to -specific sections, they will be displayed in columns titled with section name. - -### Render link to page from its code - -If you want to create a link to a page from its code, you can do either with `bitbag_cms_render_link_for_code` or `bitbag_cms_get_link_for_code` twig functions. These functions will automatically generate a link with the correct locale. - -You can define attributes to customize the tag. You can also customize the displayed name (by default the function will try to display the name when linked, if it is not defined, it will fallback to the page name). - -If you only need the link, you can use `bitbag_cms_get_link_for_code`. - -You can display a message if the page wasn't found with the `notFoundMessage` option. - -```twig -{{ bitbag_cms_render_link_for_code('code') }} -{{ bitbag_cms_render_link_for_code('code', { attr: { class: 'ui button' }, name: 'Custom name' }) }} -{{ bitbag_cms_render_link_for_code('code', {}, 'custom/template.html.twig') }} -{{ bitbag_cms_get_link_for_code('code') }} -{{ bitbag_cms_render_link_for_code('wrong-code', { notFoundMessage: 'Page not found' }) }} -{{ bitbag_cms_get_link_for_code('wrong-code', { notFoundMessage: 'Page not found' }) }} - +{{ render(path('sylius_cms_shop_page_show', {'slug' : 'about'})) }} ``` -Will render: +### Visiting the page -```html -Name when linked -Custom name - -/{_locale}/pages/{slug} -Page not found -Page not found -``` +Page URL is generated based on the page slug. Full link looks like this: `domain.com/{locale}/page/{slug}`. ## Customization -If you don't know how to override templates yet, +### Override page template + +If you don't know how to override templates yet, read [Sylius template customization guide](http://docs.sylius.org/en/latest/customization/template.html). -You can create a template under `app/Resources/BitBagSyliusCmsPlugin/views/Shop/Page` location. +You can create a template under `app/templates/bundles/SyliusCmsPlugin/Shop/Page` location. Available templates you can override can be found under [this location](../src/Resources/views/Shop/Page). diff --git a/doc/pages_cms.png b/doc/pages_cms.png index 711a53e97..f26f2136d 100644 Binary files a/doc/pages_cms.png and b/doc/pages_cms.png differ diff --git a/doc/pages_cms_result_1.png b/doc/pages_cms_result_1.png index 094238046..9c5d2c3de 100644 Binary files a/doc/pages_cms_result_1.png and b/doc/pages_cms_result_1.png differ diff --git a/doc/pages_cms_result_2.png b/doc/pages_cms_result_2.png index 8e329eac8..fe3d34be2 100644 Binary files a/doc/pages_cms_result_2.png and b/doc/pages_cms_result_2.png differ diff --git a/doc/pages_create_cms.png b/doc/pages_create_cms.png index df577ae35..ab25782c2 100644 Binary files a/doc/pages_create_cms.png and b/doc/pages_create_cms.png differ diff --git a/doc/section_cms_result.png b/doc/section_cms_result.png deleted file mode 100644 index e6d365051..000000000 Binary files a/doc/section_cms_result.png and /dev/null differ diff --git a/doc/sections.md b/doc/sections.md deleted file mode 100644 index 755c28c69..000000000 --- a/doc/sections.md +++ /dev/null @@ -1,20 +0,0 @@ -# Sections - -With sections, you can organize your blocks and pages under some specific categories. -For instance, you can create a Blog section and display pages and blocks under it. - -## General usage - -In order to render a page by section code, use: - -```twig - - {{ 'app.ui.blog'|trans }} - -``` - -If you want to list blocks by specific section, use: - -```twig -{{ render(path('bitbag_sylius_cms_plugin_shop_block_index_by_section_code', {'sectionCode' : 'blog', 'template' : '@BitBagSyliusCmsPlugin/Shop/Block/index.html.twig'})) }} -``` diff --git a/doc/sections_cms.png b/doc/sections_cms.png deleted file mode 100644 index b386589ba..000000000 Binary files a/doc/sections_cms.png and /dev/null differ diff --git a/doc/sections_create_cms.png b/doc/sections_create_cms.png deleted file mode 100644 index abcb65a86..000000000 Binary files a/doc/sections_create_cms.png and /dev/null differ diff --git a/doc/sitemap.md b/doc/sitemap.md deleted file mode 100644 index c3c90f812..000000000 --- a/doc/sitemap.md +++ /dev/null @@ -1,11 +0,0 @@ -# Sitemap - -This plugin suggests to install the Sylius sitemap plugin. The plugin is not installed automatically, but to install run: - -```bash - $ composer require stefandoorn/sitemap-plugin ^2.0@alpha -``` - -It's already configured after installation and contains a page & section provider. - -For more information, read the original [SitemapPlugin documentation](https://github.com/stefandoorn/sitemap-plugin). diff --git a/doc/template_create_cms.png b/doc/template_create_cms.png new file mode 100644 index 000000000..caf6ecdaa Binary files /dev/null and b/doc/template_create_cms.png differ diff --git a/doc/templates.gif b/doc/templates.gif new file mode 100644 index 000000000..25cf4c454 Binary files /dev/null and b/doc/templates.gif differ diff --git a/doc/templates.md b/doc/templates.md new file mode 100644 index 000000000..5a278442d --- /dev/null +++ b/doc/templates.md @@ -0,0 +1,21 @@ +# Templates + +Templates are a way to define the structure of content elements, which can be used in blocks and pages. + +![Templates usage](templates.gif) + +## General usage + +Let's assume you want to create a template for a blog post. +You want to add following content elements: +- **Title** (textarea) +- **Subtitle** (textarea) +- **Image** (single media) +- **Content** (textarea) +- **Author** (textarea) +- **Products carousel** (products carousel by taxon) + +Then, when you create a page, in the content elements section you can choose the template you created. +It will create a form with fields you defined in the template. \ +Your job is just to fill them with content. \ +Of course, you can add additional content elements to the form, after you choose the template. It's super flexible! diff --git a/doc/templates_cms.png b/doc/templates_cms.png new file mode 100644 index 000000000..7e941ced2 Binary files /dev/null and b/doc/templates_cms.png differ diff --git a/doc/twig-functions-in-admin.md b/doc/twig-functions-in-admin.md deleted file mode 100644 index 209aeb957..000000000 --- a/doc/twig-functions-in-admin.md +++ /dev/null @@ -1,27 +0,0 @@ -# Using Twig functions in admin panel - -With CMS 2.0+, you can use some Twig functions in the admin panel content. It's extremely helpful -if you wish to render a block within a page, or what's even more common - a media, for instance an -image or video. - -So far, only following functions are allowed: - -```yaml -parameters: - bitbag_cms.twig.admin_functions: - - bitbag_cms_render_block - - bitbag_cms_render_media -``` - -As this is a parameter, you can easily customize its value in your `config.yml`. - -**Note:** - -*With the parser, you are supposed to use the function with `{{ function_name('foo', 'bar') }}` format. -All characters, including spaces and apostrophes are recognized. Only string parameters are allowed.* - -*If for some reason the function would not be able to execute, an empty string result will be returned.* - -*To render the interpretable content, you need to use a special `{{ bitbag_cms_render_content([resource]) }}` Twig function. -The resource needs to implement [ContentableInterface](../src/Entity/ContentableInterface.php). -For an example, take a look at the Block's [show.html.twig](../src/Resources/views/Shop/Block/show.html.twig)* file. diff --git a/doc/use_case.md b/doc/use_case.md index 34969b332..734141e96 100644 --- a/doc/use_case.md +++ b/doc/use_case.md @@ -1,6 +1,6 @@ # What is and how to use Sylius CMS Plugin -BitBag Sylius CMS Plugin is a plugin developed for Sylius, +CMS Plugin is a plugin developed for Sylius, a popular open-source e-commerce system based on Symfony. The plugin enhances Sylius with advanced content management capabilities, allowing the creation, editing, and publication of dynamic CMS (Content Management System) pages within an e-commerce store. @@ -12,8 +12,8 @@ This empowers businesses to easily adapt their store's content to meet current n ## What Sylius CMS Plugin provides us with -When using the BitBag Sylius CMS Plugin, administrators gain access to various tiles within the admin panel, each serving a specific purpose. -These tiles include Blocks, Media, Pages, and Sections. +When using the Sylius CMS Plugin, administrators gain access to various tiles within the admin panel, each serving a specific purpose. +These tiles include Collections, Templates, Pages, Blocks and Media. ## Brief overview of what each tile offers @@ -23,55 +23,66 @@ In admin panel, the whole CMS functionality is located under "Content Management Our CMS Plugin allows you to manage: -* Sections - the containers for blocks -* Blocks - separate parts for the content -* Media - files, that can be attached to the page -* Pages - whole pages, obtainable by the link +* **Collections** - responsible for grouping the pages/blocks/media +* **Templates** - allows to create a template of content elements for the page or block +* **Pages** - whole pages, obtainable by the link +* **Blocks** - separate parts for the content, composed of the content elements +* **Media** - images, videos, etc. that can be used in other segments of the CMS --- -### Sections: -The Sections tile allows administrators to create and manage sections within CMS pages. +### Collections: -Sections serve as containers for content blocks and provide a structured way to organize content. -By utilizing sections, administrators can easily arrange and customize the layout of CMS pages to achieve the desired visual and informational structure. +The Collections tile allows administrators to create and manage collections within CMS pages. -![Screenshot showing content management config in admin](sections_cms.png) +Collections serve as containers for blocks, pages, media and provide a structured way to organize content. +By utilizing collections, administrators can group related content elements together, such as blog posts, product listings, or promotional banners. -More information about Sections you can get [here](use_case_sections.md). +![Screenshot showing content management config in admin](collections_cms.png) + +More information about Collections you can get [here](use_case_collections.md). + +### Templates: + +The Templates tile allows administrators to create and manage templates built from content elements skeletons. + +![Screenshot showing content management config in admin](templates_cms.png) + +### Pages: + +The Pages tile is where administrators can create, edit, and organize CMS pages. + +It enables the creation of various types of pages, such as the homepage, informational pages, or blog posts. + +![Screenshot showing content management config in admin](pages_cms.png) + +More information about Pages you can get [here](use_case_pages.md). ### Blocks -The Blocks tile allows administrators to create and manage reusable content blocks. -The Blocks can be utilized across different CMS pages, providing flexibility and consistency in content presentation. Blocks can contain text, images, videos, or any other desired content elements. +The Blocks tile allows administrators to create and manage blocks built from content elements. + +The Blocks can be rendered in twig templates, providing flexibility and consistency in content presentation. ![Screenshot showing content management config in admin](blocks_cms.png) More information about Blocks you can get [here](use_case_blocks.md). ### Media + The Media tile provides a centralized hub for managing media files within the CMS. -Administrators can upload and organize images, videos, and other media assets. The files can then be easily inserted into CMS pages, enriching the content with visual elements. +Administrators can upload and organize images, videos, and other media assets. The files can then be easily used in other parts of the CMS. ![Screenshot showing content management config in admin](media_cms.png) More information about Media you can get [here](use_case_media.md). -### Pages: -The Pages tile is where administrators can create, edit, and organize CMS pages. - -It enables the creation of various types of pages, such as the homepage, informational pages, or blog posts. Administrators can add content, images, and other media, customize the layout, and manage page hierarchy. - -![Screenshot showing content management config in admin](pages_cms.png) - -More information about Pages you can get [here](use_case_pages.md). - ## Summary -In summary, the BitBag Sylius CMS Plugin provides administrators with a range of tiles in the admin panel, including [Sections](use_case_sections.md), [Blocks](use_case_blocks.md), -[Media](use_case_media.md), [Pages](use_case_pages.md). +In summary, the Sylius CMS Plugin provides administrators with a range of tiles in the admin panel, +including [Collections](use_case_collections.md), [Templates](use_case_templates.md), [Pages](use_case_pages.md), [Blocks](use_case_blocks.md), [Media](use_case_media.md). -These tiles offer functionalities for managing reusable content blocks, media assets, CMS pages and page sections. +These tiles offer functionalities for managing CMS segments. Together, they enable administrators to efficiently create, edit, and organize content within the Sylius e-commerce system, resulting in a more engaging and personalized user experience. diff --git a/doc/use_case_blocks.md b/doc/use_case_blocks.md index 8096e1b5c..bda630961 100644 --- a/doc/use_case_blocks.md +++ b/doc/use_case_blocks.md @@ -1,6 +1,6 @@ # Blocks -With the BitBag SyliusCmsPlugin, administrators can arrange content blocks within sections, including the product page. +With the SyliusCmsPlugin, administrators can create and manage blocks built from content elements. This allows for customized content presentation, showcasing product features, promotions, and relevant information. @@ -20,7 +20,7 @@ By following the steps below, administrators can easily add blocks and customize 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing blocks. 3. Locate the option to create a new block and click on it. -4. Fill in the required fields in the block creation form, such as the code and content of the block. +4. Fill in the required fields in the block creation form, such as the code and name. 5. Save the block after filling in the necessary details and selecting any desired associations. 6. Repeat the process to add additional blocks, as needed. 7. After refreshing the store page, the newly implemented changes should now be visible. @@ -29,9 +29,9 @@ By following the steps below, administrators can easily add blocks and customize In the form, you will find additional fields, which will help you with your e-commerce related content: -- Products - You can select specific products that are associated with the block. This allows the block to be displayed on the product pages of the selected products. -- Sections - You can choose the sections where the block should be placed. This helps in organizing and structuring the block within the relevant sections of the website. -- Taxons - This field allows you to select specific taxonomies or categories associated with the block. By choosing relevant taxons, the block can be displayed on the pages related to those categories. +- Display for products - You can select specific products that are associated with the block. This allows the block to be displayed on the product pages of the selected products. +- Display for products in taxon - This field allows you to select specific taxon associated with the block. By choosing relevant taxon, the block will be displayed on the product pages related to those taxon. Only "Main Taxon" is taken. +- Display for taxons - This field allows you to select specific taxonomies associated with the block. By choosing relevant taxons, the block can be displayed on the pages related to those taxons. The mentioned form: diff --git a/doc/use_case_collections.md b/doc/use_case_collections.md new file mode 100644 index 000000000..4b5b97185 --- /dev/null +++ b/doc/use_case_collections.md @@ -0,0 +1,40 @@ +# Collections + +With collections, you can organize your blocks, pages and media under specific categories. +For instance, you can create a Blog collection and display pages under it. + +Collections in the Sylius CMS Plugin serve as containers where various elements, such as content blocks, CMS pages, +and media, can be placed. These collections allow administrators to organize and manage the layout and presentation of content on pages. + +The ability to place blocks, pages, and media within collections provides full control over the appearance and structure of CMS pages, +enabling the creation of visually appealing and cohesive content layouts. Collections offer flexibility in designing pages, +allowing for customization and adaptation of displayed content to user preferences and marketing strategies. + +**Note.** If you haven't implemented the collection properly in your code yet, please visit the [Collections](collections.md) tech doc. + +## The process of creating a Collection: + +By following the steps below, administrators can add collections by providing the code, name and type for each collection. +These collections can be then utilized within the CMS pages for organizing and structuring content. + +1. Please access the administrator panel of the Sylius e-commerce system. +2. Navigate to the CMS section or the designated area for managing collections. +3. Select the option to create a new collection. +4. Fill in the required fields in the collection creation form, such as the code, name and type of the collection. +5. Save the collection after providing the necessary details. +6. Repeat the process to add additional collections, as needed. +7. After refreshing the store page, the newly implemented changes should now be visible. + +The mentioned form: + +![Screenshot showing content management config in admin](collections_create_cms.png) + +## Result possible to achieve on the front of the store: + +It's possible to attach [Blocks](use_case_blocks.md), [Media](use_case_media.md) and [Pages](use_case_pages.md) to the Collections. This makes you able to [display all](collections.md) the content attached to the single Collection. + +The image below presents you a sample result of Collection rendered on the product page: + +![Screenshot showing content management config in admin](collections_cms_result.png) + + diff --git a/doc/use_case_media.md b/doc/use_case_media.md index 3bcacc8ae..9197014a8 100644 --- a/doc/use_case_media.md +++ b/doc/use_case_media.md @@ -2,7 +2,7 @@ In this plugin, media represents digital assets, for instance, an image, a video, or a simple PDF file. -The BitBag SyliusCmsPlugin enables administrators to add and display various types of media, such as images, videos, and files, in desired locations throughout the website. +The Sylius CMS Plugin enables administrators to add and display various types of media, such as images, videos, and files, in desired locations throughout the website. This functionality allows for the seamless integration of media elements using HTML tags, providing a visually engaging experience for users. @@ -16,7 +16,7 @@ Currently, it supports the following media types: ## The process of creating a Media -By following these steps bellow, administrators can easily add media items and customize their associations with products and sections. This provides control over where the media is displayed, ensuring it appears in the desired locations throughout the website. +By following these steps bellow, administrators can easily add and manage media. 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing media. @@ -30,8 +30,11 @@ By following these steps bellow, administrators can easily add media items and c In the form, you will find additional fields, which will help you with your e-commerce related content: -- Products - You can select specific products to associate with the media item. This ensures that the media will be displayed on the product pages of the selected products. -- Sections - You can choose the sections where the media should be placed. This allows for precise positioning and organization of the media within the relevant sections of the website. +- Collections - You can choose the collections where the media should be placed. This allows for precise positioning and organization of the media within the relevant collections of the website. +- Translations: + - Alt - The alternative text for the media item. + - Link - The URL in which the media item should redirect to. + - Link content - Description of the media item link. The mentioned form: @@ -39,7 +42,4 @@ The mentioned form: ## Result possible to achieve on the front of the store: -The image below presents you a sample result of [Section](sections.md) rendered on the product page, which contains [Blocks](blocks.md) and Media (image, video and downloadable PDF file): - -![Screenshot showing content management config in admin](media_cms_result.png) - +![Screenshot showing media result in front page](media_cms_result.png) diff --git a/doc/use_case_pages.md b/doc/use_case_pages.md index c6c8e703e..bb17773c9 100644 --- a/doc/use_case_pages.md +++ b/doc/use_case_pages.md @@ -2,12 +2,9 @@ Pages represent a customizable web page, you can adjust them to your needs in the admin panel. -With the BitBag SyliusCmsPlugin, administrators can associate related products with CMS pages, displaying them in the designated section. +With the Sylius CMS Plugin, administrators can create page content using content elements section. -This feature allows for targeted product recommendations and cross-selling opportunities within the content. - -Additionally, administrators can incorporate media elements, such as images and videos, into the pages, -enriching the visual presentation and engaging users. +Additionally, administrators can set teaser image, title and content to be displayed on the pages collection listing. The flexibility of the plugin empowers administrators to create compelling CMS pages that seamlessly integrate product information and multimedia content, enhancing the overall user experience. @@ -16,22 +13,24 @@ information and multimedia content, enhancing the overall user experience. ## The process of creating a Page -By following the steps below, administrators can add pages and associate them with products, allowing the pages to display relevant product information. This integration enhances the browsing experience by providing seamless access to product details directly from the associated pages. +By following the steps below, administrators can add pages. 1. Please access the administrator panel of the Sylius e-commerce system. 2. Navigate to the CMS section or the designated area for managing pages. 3. Select the option to create a new page. -4. Fill in the required fields in the page creation form, such as the name, content, and slug. -5. Save the page after filling in the necessary details and selecting any desired associations. +4. Fill in the required fields in the page creation form, such as the name, code and slug. +5. Save the page after filling in the necessary details. 6. Repeat the process to add additional pages, as needed. 7. After refreshing the store page, the newly implemented changes should now be visible. -### Optional configuration +### Additional configuration -In the form, you will find fields, which will help you with your e-commerce related content: +In the form, you can also set SEO settings for the page: +- Meta title +- Meta keywords +- Meta description -- Products - You can associate specific products with the page. This means that the page will display and provide information related to the selected products. -- Sections - You can choose the sections where the page should be placed, ensuring proper organization and positioning of the page within the website's structure. +Additionally, you can set the page teaser image, title and content to be displayed on the pages collection listing. The mentioned form: @@ -39,11 +38,11 @@ The mentioned form: ## Result possible to achieve on the front of the store: -The image below displays a [Section](sections.md), to which we have attached two pages: +The image below displays a simple Blog page with listing of posts: ![Screenshot showing content management config in admin](pages_cms_result_1.png) -Additionally, every page has its own slug, so you can access its all contents by visiting it by a full URL: +The image below displays a simple Blog post: ![Screenshot showing content management config in admin](pages_cms_result_2.png) diff --git a/doc/use_case_sections.md b/doc/use_case_sections.md deleted file mode 100644 index 0f5405eba..000000000 --- a/doc/use_case_sections.md +++ /dev/null @@ -1,39 +0,0 @@ -# Sections - -With sections, you can organize your blocks and pages under specific categories. -For instance, you can create a Blog section and display pages and blocks under it. - -Sections in the BitBag SyliusCmsPlugin serve as containers where various elements, such as content blocks, CMS pages, -and media, can be placed. These sections allow administrators to organize and manage the layout and presentation of content on pages. - -The ability to place blocks, pages, and media within sections provides full control over the appearance and structure of CMS pages, -enabling the creation of visually appealing and cohesive content layouts. Sections offer flexibility in designing pages, -allowing for customization and adaptation of displayed content to user preferences and marketing strategies. - -**Note.** If you haven't implemented the section properly in your code yet, please visit the [Sections](sections.md) tech doc. - -## The process of creating a Section: - -By following the steps below, administrators can add sections by providing the code and name for each section. These sections can be then utilized within the CMS pages for organizing and structuring content. - -1. Please access the administrator panel of the Sylius e-commerce system. -2. Navigate to the CMS section or the designated area for managing sections. -3. Select the option to create a new section. -4. Fill in the required fields in the section creation form, such as the code and name of the section. -5. Save the section after providing the necessary details. -6. Repeat the process to add additional sections, as needed. -7. After refreshing the store page, the newly implemented changes should now be visible. - -The mentioned form: - -![Screenshot showing content management config in admin](sections_create_cms.png) - -## Result possible to achieve on the front of the store: - -It's possible to attach [Blocks](use_case_blocks.md), [Media](use_case_media.md) and [Pages](use_case_pages.md) to the Sections. This makes you able to [display all](sections.md) the content attached to the single Section. - -The image below presents you a sample result of Section rendered on the product page, to which we attached Pages to get the simple Blog result: - -![Screenshot showing content management config in admin](section_cms_result.png) - - diff --git a/doc/use_case_templates.md b/doc/use_case_templates.md new file mode 100644 index 000000000..35a3349af --- /dev/null +++ b/doc/use_case_templates.md @@ -0,0 +1,20 @@ +# Templates + +In this plugin, templates are responsible for defining the structure of content elements, which can be used in blocks and pages. + +## The process of creating a Template + +By following these steps below, administrators can easily add and manage templates. + +1. Please access the administrator panel of the Sylius e-commerce system. +2. Navigate to the CMS section or the designated area for managing templates. +3. Select the option to create a new template item. +4. Fill in the required fields in the template creation form, such as the name and type. +5. Add some content elements. +6. Save the template item after filling in the necessary details. +7. Repeat the process to add additional template items, as needed. +8. Now you can use templates in blocks and pages. + +The mentioned form: + +![Screenshot showing template creation form in admin](template_create_cms.png) diff --git a/doc/wysiwyg.md b/doc/wysiwyg.md index a8991eb7b..399a76ca1 100644 --- a/doc/wysiwyg.md +++ b/doc/wysiwyg.md @@ -9,9 +9,6 @@ is being created. You can use a custom [WysiwygType](../src/Form/Type/WysiwygType.php) any place you want the CKEditor to appear in. Take [the BlockTranslationType](../src/Form/Type/Translation/BlockTranslationType.php) as an example. -**Note:** -*In the WYSIWYG fields, you can use Twig function nesting. Read more [here](twig-functions-in-admin.md).* - ## Configuration If you want to customize any behavior of the CKEditor, you have to override one of these files: [CKEditor config](../src/Resources/config/fos_ck_editor/fos_ck_editor.yml) or [CKEditor js config](../src/Resources/views/Form/ckeditor_widget.html.twig) diff --git a/features/admin/adding_block.feature b/features/admin/adding_block.feature index 29dd78dfc..c721508ec 100644 --- a/features/admin/adding_block.feature +++ b/features/admin/adding_block.feature @@ -187,7 +187,6 @@ Feature: Adding blocks And I fill the code with "intro" And I fill the name with "Intro" And I select "Homepage" template - And I click button to use this template And I confirm that I want to use this template And I add it Then I should be notified that the block has been created diff --git a/features/admin/adding_media.feature b/features/admin/adding_media.feature index d5463584d..0ee4fe3c5 100644 --- a/features/admin/adding_media.feature +++ b/features/admin/adding_media.feature @@ -13,7 +13,6 @@ Feature: Adding new media When I go to the create media page And I fill the code with "image" And I fill the name with "Image" - And I fill the link content with "Main image" And I upload the "aston_martin_db_11.jpg" image And I add it Then I should be notified that new media has been created diff --git a/features/admin/adding_page.feature b/features/admin/adding_page.feature index b6df542d7..9f2881eb9 100644 --- a/features/admin/adding_page.feature +++ b/features/admin/adding_page.feature @@ -217,7 +217,6 @@ Feature: Adding new page And I fill the slug with "my_page" And I fill the name with "My page" And I select "Homepage" template - And I click button to use this template And I confirm that I want to use this template And I add it Then I should be notified that the page has been created diff --git a/features/admin/managing_blocks.feature b/features/admin/managing_blocks.feature index 311e55aac..78aaf6d43 100644 --- a/features/admin/managing_blocks.feature +++ b/features/admin/managing_blocks.feature @@ -46,8 +46,8 @@ Feature: Managing cms blocks @ui Scenario: Disabling block - Given there is an existing block with "bitbag_quote" code - When I go to the update "bitbag_quote" block page + Given there is an existing block with "sylius_quote" code + When I go to the update "sylius_quote" block page And I fill the name with "BitBag quote" if the name field is empty And I disable it And I update it diff --git a/phpspec.yml.dist b/phpspec.yml.dist index 510348697..767848352 100755 --- a/phpspec.yml.dist +++ b/phpspec.yml.dist @@ -1,4 +1,4 @@ suites: main: - namespace: BitBag\SyliusCmsPlugin - psr4_prefix: BitBag\SyliusCmsPlugin + namespace: Sylius\CmsPlugin + psr4_prefix: Sylius\CmsPlugin diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aa1bc1a44..29597412f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,13 +6,13 @@ colors="true" bootstrap="tests/Application/config/bootstrap.php"> - + tests - + diff --git a/public/build/cms/admin/entrypoints.json b/public/build/cms/admin/entrypoints.json new file mode 100644 index 000000000..d9e189cf2 --- /dev/null +++ b/public/build/cms/admin/entrypoints.json @@ -0,0 +1,12 @@ +{ + "entrypoints": { + "sylius-cms-admin": { + "css": [ + "/build/cms/admin/sylius-cms-admin.css" + ], + "js": [ + "/build/cms/admin/sylius-cms-admin.js" + ] + } + } +} \ No newline at end of file diff --git a/public/build/cms/admin/manifest.json b/public/build/cms/admin/manifest.json new file mode 100644 index 000000000..3d79b2d55 --- /dev/null +++ b/public/build/cms/admin/manifest.json @@ -0,0 +1,4 @@ +{ + "build/cms/admin/sylius-cms-admin.css": "/build/cms/admin/sylius-cms-admin.css", + "build/cms/admin/sylius-cms-admin.js": "/build/cms/admin/sylius-cms-admin.js" +} \ No newline at end of file diff --git a/public/build/cms/admin/sylius-cms-admin.css b/public/build/cms/admin/sylius-cms-admin.css new file mode 100644 index 000000000..49fef1082 --- /dev/null +++ b/public/build/cms/admin/sylius-cms-admin.css @@ -0,0 +1 @@ +#cms-resource-preview-modal{height:100%}#cms-resource-preview-modal iframe{height:100vh;width:100%}#cms-resource-preview-modal .ui.header{padding-bottom:0}.cms-import .ui.action.input input[type=file]{display:none}.cms-import .ui.action.input input[type=text]{width:auto}.media-list{grid-gap:20px;display:grid;grid-template-columns:repeat(6,150px);margin:0 auto}.media-list__item{align-items:flex-start;display:flex;flex-direction:column;justify-content:space-between;max-width:150px;position:relative!important}.media-list__item__label,.media-list__item__label>strong{word-wrap:break-word!important;white-space:-moz-pre-wrap!important;white-space:-webkit-pre-wrap!important;white-space:-pre-wrap!important;white-space:-o-pre-wrap!important;white-space:pre-wrap!important;white-space:normal!important;word-break:break-all!important}.media-list__item__label>strong{display:block!important}.media-list__item__input{bottom:10px;position:absolute!important;right:10px;z-index:99}.media-list__item__input:hover{cursor:pointer}.media-list__item__img{height:150px!important;width:150px!important}.btn{display:inline-block!important;font-size:1.4em!important}.btn:hover{cursor:pointer}.page-number{font-size:1.4em!important}.btn-delete{color:#db2828;cursor:pointer;font-weight:700;height:20px;position:absolute;right:30px;width:20px;z-index:5}.btn-delete.is-hidden{opacity:.2;pointer-events:none}.cms-media-autocomplete .dropdown.icon{pointer-events:none}.cms-media-autocomplete .search{cursor:pointer!important}.bb-collection-item{margin-bottom:1em}.bb-collection-item-delete{margin-top:5px!important}.cke_notifications_area{display:none}.help-text{font-size:12px;margin-top:-10px;opacity:.5} \ No newline at end of file diff --git a/public/build/cms/admin/sylius-cms-admin.js b/public/build/cms/admin/sylius-cms-admin.js new file mode 100644 index 000000000..e1bee5273 --- /dev/null +++ b/public/build/cms/admin/sylius-cms-admin.js @@ -0,0 +1,2 @@ +/*! For license information please see sylius-cms-admin.js.LICENSE.txt */ +(()=>{var t={461:()=>{$(document).ready((function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){$(e).autoComplete()}));var t="#sylius_cms_page_contentElements",e=$(t).length?t:"#sylius_cms_block_contentElements";$(e).length&&($(document).on("collection-form-add",(function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){void 0===$._data($(e).get(0),"events")&&$(e).autoComplete()})),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)}))})),$.fn.extend({loadContentConfiguration:function(t){t.querySelector("".concat(e,' select[name*="type"]')).onchange=function(){var t=this.parentElement,e=document.createElement("div"),r=this.selectedOptions[0];e.innerHTML=r.getAttribute("data-configuration");var n=t.nextElementSibling;t.parentElement.replaceChild(e,n);var o=n.querySelector("input");o||(o=n.querySelector("textarea"));var i=o.getAttribute("name"),a=e.querySelectorAll("input");a.length||(a=e.querySelectorAll("textarea")),a.forEach((function(t){var r=t.getAttribute("name");r&&(r=i.replace(i.substring(i.indexOf("[configuration]")+15),r.substring(r.indexOf("configuration")+13)),$(t).attr("name",r),$(e).find(".bitbag-media-autocomplete").autoComplete(),$(e).find(".sylius-autocomplete").autoComplete())}))}}}),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)})),$(document).loadContentConfiguration(document.querySelector("".concat(e,' [data-form-collection="item"]'))))}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(()=>{"use strict";r(461);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{textField:"data-bb-cms-text",fileField:"data-bb-cms-file"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.textField=document.querySelector("[".concat(e.textField,"]")),this.fileField=document.querySelector("[".concat(e.fileField,"]"))},n=[{key:"init",value:function(){if("object"!==t(this.config))throw new Error("Bitbag CMS Plugin - HandleCsvUpload class config is not a valid object");this._handleFields()}},{key:"_handleFields",value:function(){this._handleTextField(),this._handleFileField()}},{key:"_handleTextField",value:function(){var t=this;this.textField.addEventListener("click",(function(){t.fileField.click()}))}},{key:"_handleFileField",value:function(){var t=this;this.fileField.addEventListener("change",(function(e){t.textField.value=e.target.files[0].name}))}}],n&&e(r.prototype,n),o&&e(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}();const i=function(t,e,r){var n=new CustomEvent("".concat("bb",".").concat(e),{detail:r});return t.dispatchEvent(n),t};function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function S(){}var _={};f(_,c,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,c)&&(_=L);var x=S.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=d(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==l(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=d(e,r,n);if("normal"===l.type){if(o=n.done?m:y,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function c(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function s(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{wrappersIndicator:"data-bb-cms-wrapper",lockFieldIndicator:"data-bb-cms-toggle-slug",bbTarget:"sylius_cms_page",nameField:"sylius_cms_page_name"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wrappers=document.querySelectorAll("[".concat(e.wrappersIndicator,"]")),this.lockFieldIndicator="[".concat(e.lockFieldIndicator,"]"),this.bbTarget=e.bbTarget,this.config=e,this.nameField=document.getElementById("".concat(e.nameField))},e=[{key:"init",value:function(){if("object"!==l(this.config))throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config is not a valid object");if("string"!=typeof this.lockFieldIndicator||"string"!=typeof this.bbTarget)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config key values are not valid strings");if(!this.nameField)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate name field not found");this._handleFields()}},{key:"_handleFields",value:function(){var t=this;this.wrappers.forEach((function(e){var r=e.dataset.locale,n=e.querySelector("#".concat(t.bbTarget,"_translations_").concat(r,"_slug"));if(n||(n=e.querySelector("#".concat(t.bbTarget,"_slug"))),n){var o;t.nameField.addEventListener("input",(function(e){e.preventDefault(),n.readOnly||(clearTimeout(o),o=setTimeout((function(){t._updateSlug(n,t.nameField.value)}),1e3))}));var i=e.querySelector(t.lockFieldIndicator);i&&i.addEventListener("click",(function(e){e.preventDefault(),t._toggleSlugModification(n,i)}))}}))}},{key:"_updateSlug",value:(o=u(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i(e,"cms.slug.update.start"),e.parentNode.classList.add("loading"),t.next=4,this._getValidSlug(e.dataset.url,r);case 4:e.value=t.sent,e.parentNode.classList.remove("loading"),i(e,"cms.slug.update.end");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"_getValidSlug",value:(n=u(a().mark((function t(e,r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("".concat(e,"?name=").concat(encodeURIComponent(r)));case 3:return n=t.sent,t.next=6,n.json();case 6:return o=t.sent,t.abrupt("return",o.slug);case 10:t.prev=10,t.t0=t.catch(0),console.error("BitBag CMS Plugin - HandleSlugUpdate class error : ".concat(t.t0));case 13:case"end":return t.stop()}}),t,null,[[0,10]])}))),function(t,e){return n.apply(this,arguments)})},{key:"_toggleSlugModification",value:function(t,e){t.readOnly=!t.readOnly;var r=e.querySelector("i");r.classList.toggle("lock"),r.classList.toggle("unlock")}}],e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function S(){}var _={};l(_,a,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,a)&&(_=L);var x=S.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==m(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function p(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function y(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{previewButton:"data-bb-cms-preview-btn",previewModal:"data-bb-cms-preview-modal",channelSwitch:"data-bb-cms-channel",localeSwitch:"data-bb-cms-locale"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.button=document.querySelector("[".concat(e.previewButton,"]")),this.modal=document.querySelector("[".concat(e.previewModal,"]")),this.modalSelector=e.previewModal,this.channelSelector=e.channelSwitch,this.localeSelector=e.localeSwitch},e=[{key:"init",value:function(){if("object"!==m(this.config))throw new Error("Bitbag CMS Plugin - HandlePreview class config is not a valid object");if("string"!=typeof this.localeSelector||"string"!=typeof this.channelSelector||"string"!=typeof this.modalSelector)throw new Error("Bitbag CMS Plugin - HandlePreview class config key values are not valid strings");this._resourcePreview()}},{key:"_$_CKEDITOR_MODAL_SHOW",value:function(){return $("[".concat(this.modalSelector,"]")).modal("show")}},{key:"_$_CKEDITOR_UPDATE_INSTANCES",value:function(){y(CKEDITOR.instances).forEach((function(t){return t.updateElement()}))}},{key:"_resourcePreview",value:function(){var t=this;this.button.addEventListener("click",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.channelSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.localeSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()}))}},{key:"_createPreview",value:(n=d().mark((function t(){var e,r,n,o,a,c,u,l,s;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.modal.querySelector(".ui.loadable").classList.add("loading"),this.modal.disabled=!0,e=document.querySelector("[".concat(this.channelSelector,"]")).value,r=document.querySelector("[".concat(this.localeSelector,"]")).value,n=this.button.dataset.url,o=this.button.closest("form"),a={method:"POST",body:new FormData(o)},t.prev=7,i(this.modal,"cms.create.preview.start"),t.next=11,fetch("".concat(n,"?_channel_code=").concat(e,"&_locale=").concat(r),a);case 11:return c=t.sent,t.next=14,c.text();case 14:u=t.sent,l=new Blob([u],{type:"text/html",charset:"utf-8"}),s=window.URL.createObjectURL(l),this.modal.querySelector("iframe").src=s,i(this.modal,"cms.create.preview.completed",u),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(7),console.error("BitBag CMS Plugin - HandlePreview class error : ".concat(t.t0)),i(this.modal,"cms.create.preview.error",t.t0);case 25:return t.prev=25,this.modal.querySelector(".ui.loadable").classList.remove("loading"),this.modal.disabled=!1,i(this.modal,"cms.create.preview.end"),t.finish(25);case 30:case"end":return t.stop()}}),t,this,[[7,21,25,30]])})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){p(i,r,o,a,c,"next",t)}function c(t){p(i,r,o,a,c,"throw",t)}a(void 0)}))},function(){return o.apply(this,arguments)})}],e&&g(t.prototype,e),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function S(){S=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(F([])));E&&E!==r&&n.call(E,a)&&(w=E);var L=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==k(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:d,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function _(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{bbMediaContainer:"data-bb-cms-autocomplete",choiceName:"data-bb-cms-choice-name",choiceValue:"data-bb-cms-choice-value",criteriaType:"data-bb-cms-criteria-type",criteriaName:"data-bb-cms-criteria-name",editUrl:"data-bb-cms-load-edit-url",nameMessage:"data-bb-cms-name-message",deleteButton:"data-bb-cms-delete-selected",choosenPreview:"data-bb-cms-selected-image",selectMenu:"data-bb-cms-selection-menu",selectInput:"data-bb-cms-image-select",placeholder:"data-bb-cms-placeholder",limit:30};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.mediaContainers=document.querySelectorAll("[".concat(e.bbMediaContainer,"]")),this.deleteButton="[".concat(e.deleteButton,"]"),this.selectMenu="[".concat(e.selectMenu,"]"),this.selectInput="[".concat(e.selectInput,"]"),this.placeholder="[".concat(e.placeholder,"]")},e=[{key:"init",value:function(){var t=this;if("object"!==k(this.config))throw new Error("Bitbag CMS Plugin - HandleAutoComplete class config is not a valid object");this.mediaContainers.forEach((function(e){t._handleSavedValue(e),t._handleImageChoice(e),t._handleResetBtn(e)}))}},{key:"_handleResetBtn",value:function(t){var e=this,r=t.querySelector(this.deleteButton);""!==t.querySelector("input[type=hidden]").value?(r.classList.remove("is-hidden"),r.addEventListener("click",(function(){e._resetValues(t)}))):r.classList.add("is-hidden")}},{key:"_handleImageChoice",value:function(t){var e,r=this;t.querySelector(this.selectInput).addEventListener("click",(function(e){e.preventDefault(),r._getMediaImages(t)})),t.querySelector(this.selectInput).addEventListener("input",(function(n){n.preventDefault(),clearTimeout(e),e=setTimeout((function(){r._getMediaImages(t,n.target.value)}),500)})),t.querySelector("input[type=hidden]").addEventListener("change",(function(e){e.preventDefault(),r._handleResetBtn(t)}))}},{key:"_handleSavedValue",value:(o=x(S().mark((function t(e){var r,n,o,a,c,u,l;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""!==e.querySelector("input[type=hidden]").value){t.next=2;break}return t.abrupt("return");case 2:return r="".concat(e.dataset.bbCmsLoadEditUrl,"?").concat(e.querySelector("input[type=hidden]").value.split(",").filter(String).map((function(t){return"code[]=".concat(t)})).join("&")),t.prev=3,i(e,"cms.media.saved.reload.start"),e.classList.add("loading"),t.next=8,fetch(r);case 8:return n=t.sent,t.next=11,n.json();case 11:o=t.sent,this._addToSelectMenu(o,e),a=[],null!==(c=e.querySelector(this.selectMenu))&&(a=c.children),u=_(a);try{for(u.s();!(l=u.n()).done;)l.value.click()}catch(t){u.e(t)}finally{u.f()}i(e,"cms.media.saved.reload.completed",o),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(3),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.saved.reload.error",t.t0);case 25:return t.prev=25,e.classList.remove("loading"),i(e,"cms.media.saved.reload.end"),t.finish(25);case 29:case"end":return t.stop()}}),t,this,[[3,21,25,29]])}))),function(t){return o.apply(this,arguments)})},{key:"_getMediaImages",value:(n=x(S().mark((function t(e){var r,n,o,a,c,u,l,s,f=arguments;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=f.length>1&&void 0!==f[1]&&f[1],n=e.dataset.bbCmsUrl,o=e.dataset.bbCmsCriteriaType,a=r?"&criteria[search][value]=".concat(r):"",c="".concat(n,"&limit=").concat(this.config.limit,"&criteria[search][type]=").concat(o,"&criteria[search][value]=").concat(a),t.prev=5,i(e,"cms.media.display.start"),e.classList.add("loading"),t.next=10,fetch(c);case 10:return u=t.sent,t.next=13,u.json();case 13:l=t.sent,s=l._embedded.items,this._addToSelectMenu(s,e),i(e,"cms.media.display.completed",l),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(5),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.display.error",t.t0);case 23:return t.prev=23,e.classList.remove("loading"),i(e,"cms.media.display.end"),t.finish(23);case 27:case"end":return t.stop()}}),t,this,[[5,19,23,27]])}))),function(t){return n.apply(this,arguments)})},{key:"_resetValues",value:function(t){i(t,"cms.media.reset.start"),t.querySelector("input[type=hidden]").value="",t.querySelector(this.selectMenu).innerHTML="",t.querySelector(this.placeholder).innerHTML="",i(t,"cms.media.reset.end")}},{key:"_addToSelectMenu",value:function(t,e){var r=this;i(e,"cms.media.display.update.start");var n=e.querySelector(this.selectMenu);n.innerHTML="",null!==t&&t.forEach((function(t){n.insertAdjacentHTML("beforeend",r._itemTemplate(t.path,t.code.trim()))})),i(e,"cms.media.display.update.end")}},{key:"_itemTemplate",value:function(t,e){return'
').concat(e,"
")}}],e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function C(t,e){for(var r=0;r0&&(new h).init(),document.querySelectorAll("[data-bb-cms-preview-btn]").length>0&&(new w).init(),document.querySelector('[data-bb-target="cms-handle-autocomplete"]')&&(new P).init(),document.querySelector(".collection-type-items")&&(new F).init(),document.querySelector("[data-bb-cms-load-template]")&&(new N).init()})()})(); \ No newline at end of file diff --git a/src/Resources/public/build/bitbag-cms-admin.js.LICENSE.txt b/public/build/cms/admin/sylius-cms-admin.js.LICENSE.txt similarity index 100% rename from src/Resources/public/build/bitbag-cms-admin.js.LICENSE.txt rename to public/build/cms/admin/sylius-cms-admin.js.LICENSE.txt diff --git a/public/build/cms/shop/entrypoints.json b/public/build/cms/shop/entrypoints.json new file mode 100644 index 000000000..583631555 --- /dev/null +++ b/public/build/cms/shop/entrypoints.json @@ -0,0 +1,12 @@ +{ + "entrypoints": { + "sylius-cms-shop": { + "css": [ + "/build/cms/shop/sylius-cms-shop.css" + ], + "js": [ + "/build/cms/shop/sylius-cms-shop.js" + ] + } + } +} \ No newline at end of file diff --git a/public/build/cms/shop/manifest.json b/public/build/cms/shop/manifest.json new file mode 100644 index 000000000..11b62d10f --- /dev/null +++ b/public/build/cms/shop/manifest.json @@ -0,0 +1,4 @@ +{ + "build/cms/shop/sylius-cms-shop.css": "/build/cms/shop/sylius-cms-shop.css", + "build/cms/shop/sylius-cms-shop.js": "/build/cms/shop/sylius-cms-shop.js" +} \ No newline at end of file diff --git a/public/build/cms/shop/sylius-cms-shop.css b/public/build/cms/shop/sylius-cms-shop.css new file mode 100644 index 000000000..fa24c6ec9 --- /dev/null +++ b/public/build/cms/shop/sylius-cms-shop.css @@ -0,0 +1 @@ +.cms-block{margin-bottom:20px}.cms-block img{max-width:100%}.carousel-wrapper{position:relative}.carousel-wrapper .carousel{margin:0 -1em}.carousel-wrapper .carousel-nav .carousel-left{left:30px}.carousel-wrapper .carousel-nav .carousel-right{right:30px}.carousel-wrapper .carousel-nav .carousel-left,.carousel-wrapper .carousel-nav .carousel-right{position:absolute;top:50%;transform:translateY(-50%)}.carousel-wrapper .carousel-item{padding:5px 1em}.teaser__content{margin-top:10px}.teaser__description{margin-top:5px}.teaser__read-more{display:block;margin-top:20px}[class^=cms_content_element__]:not(:last-child){margin-bottom:1rem} \ No newline at end of file diff --git a/src/Resources/public/build/bitbag-cms-shop.js b/public/build/cms/shop/sylius-cms-shop.js similarity index 100% rename from src/Resources/public/build/bitbag-cms-shop.js rename to public/build/cms/shop/sylius-cms-shop.js diff --git a/spec/Assigner/ChannelsAssignerSpec.php b/spec/Assigner/ChannelsAssignerSpec.php index 3bcb6e409..5fc38fc80 100644 --- a/spec/Assigner/ChannelsAssignerSpec.php +++ b/spec/Assigner/ChannelsAssignerSpec.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace spec\BitBag\SyliusCmsPlugin\Assigner; +namespace spec\Sylius\CmsPlugin\Assigner; -use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssigner; -use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssignerInterface; use PhpSpec\ObjectBehavior; +use Sylius\CmsPlugin\Assigner\ChannelsAssigner; +use Sylius\CmsPlugin\Assigner\ChannelsAssignerInterface; use Sylius\Component\Channel\Model\ChannelsAwareInterface; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Core\Model\ChannelInterface; @@ -32,10 +32,9 @@ public function it_assigns_channels( ChannelRepositoryInterface $channelRepository, ChannelInterface $webChannel, ChannelInterface $posChannel, - ChannelsAwareInterface $channelsAware + ChannelsAwareInterface $channelsAware, ): void { - $channelRepository->findOneBy(['code' => 'web'])->willReturn($webChannel); - $channelRepository->findOneBy(['code' => 'pos'])->willReturn($posChannel); + $channelRepository->findBy(['code' => ['web', 'pos']])->willReturn([$webChannel, $posChannel]); $channelsAware->addChannel($webChannel)->shouldBeCalled(); $channelsAware->addChannel($posChannel)->shouldBeCalled(); diff --git a/spec/Assigner/CollectionsAssignerSpec.php b/spec/Assigner/CollectionsAssignerSpec.php index 898ad2de7..0e95b878e 100644 --- a/spec/Assigner/CollectionsAssignerSpec.php +++ b/spec/Assigner/CollectionsAssignerSpec.php @@ -1,21 +1,15 @@ findOneBy(['code' => 'about'])->willReturn($aboutCollection); - $collectionRepository->findOneBy(['code' => 'blog'])->willReturn($blogCollection); + CollectibleInterface $collectionsAware, + ): void { + $collectionRepository->findBy(['code' => ['about', 'blog']])->willReturn([$aboutCollection, $blogCollection]); $collectionsAware->addCollection($aboutCollection)->shouldBeCalled(); $collectionsAware->addCollection($blogCollection)->shouldBeCalled(); diff --git a/spec/Assigner/LocalesAssignerSpec.php b/spec/Assigner/LocalesAssignerSpec.php index e757ff87b..7e2da73fb 100644 --- a/spec/Assigner/LocalesAssignerSpec.php +++ b/spec/Assigner/LocalesAssignerSpec.php @@ -1,19 +1,13 @@ getCode()->willReturn('en_US'); $locale2->getCode()->willReturn('fr_FR'); - $localeRepository->findAll()->willReturn([$locale1, $locale2]); + $localeRepository->findBy(['code' => ['en_US', 'fr_FR']])->willReturn([$locale1, $locale2]); $localesAware->addLocale($locale1)->shouldBeCalled(); $localesAware->addLocale($locale2)->shouldBeCalled(); diff --git a/spec/Assigner/ProductsAssignerSpec.php b/spec/Assigner/ProductsAssignerSpec.php index e1b999612..e79e07ee3 100644 --- a/spec/Assigner/ProductsAssignerSpec.php +++ b/spec/Assigner/ProductsAssignerSpec.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace spec\BitBag\SyliusCmsPlugin\Assigner; +namespace spec\Sylius\CmsPlugin\Assigner; -use BitBag\SyliusCmsPlugin\Assigner\ProductsAssigner; -use BitBag\SyliusCmsPlugin\Assigner\ProductsAssignerInterface; -use BitBag\SyliusCmsPlugin\Entity\ProductsAwareInterface; use PhpSpec\ObjectBehavior; +use Sylius\CmsPlugin\Assigner\ProductsAssigner; +use Sylius\CmsPlugin\Assigner\ProductsAssignerInterface; +use Sylius\CmsPlugin\Entity\ProductsAwareInterface; use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Repository\ProductRepositoryInterface; @@ -32,10 +32,9 @@ public function it_assigns_products( ProductRepositoryInterface $productRepository, ProductInterface $mugProduct, ProductInterface $tshirtProduct, - ProductsAwareInterface $productsAware + ProductsAwareInterface $productsAware, ): void { - $productRepository->findOneBy(['code' => 'mug'])->willReturn($mugProduct); - $productRepository->findOneBy(['code' => 't-shirt'])->willReturn($tshirtProduct); + $productRepository->findBy(['code' => ['mug', 't-shirt']])->willReturn([$mugProduct, $tshirtProduct]); $productsAware->addProduct($mugProduct)->shouldBeCalled(); $productsAware->addProduct($tshirtProduct)->shouldBeCalled(); diff --git a/spec/Assigner/ProductsInTaxonsAssignerSpec.php b/spec/Assigner/ProductsInTaxonsAssignerSpec.php index 6d5454f95..4b98ad9ce 100644 --- a/spec/Assigner/ProductsInTaxonsAssignerSpec.php +++ b/spec/Assigner/ProductsInTaxonsAssignerSpec.php @@ -1,19 +1,13 @@ getCode()->willReturn('taxon_code_1'); $taxon2->getCode()->willReturn('taxon_code_2'); - $taxonRepository->findOneBy(['code' => 'taxon_code_1'])->willReturn($taxon1); - $taxonRepository->findOneBy(['code' => 'taxon_code_2'])->willReturn($taxon2); + $taxonRepository->findBy(['code' => ['taxon_code_1', 'taxon_code_2']])->willReturn([$taxon1, $taxon2]); $productsInTaxonsAware->addProductsInTaxon($taxon1)->shouldBeCalled(); $productsInTaxonsAware->addProductsInTaxon($taxon2)->shouldBeCalled(); diff --git a/spec/Assigner/TaxonsAssignerSpec.php b/spec/Assigner/TaxonsAssignerSpec.php index 7eade976e..b8933ff98 100644 --- a/spec/Assigner/TaxonsAssignerSpec.php +++ b/spec/Assigner/TaxonsAssignerSpec.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace spec\BitBag\SyliusCmsPlugin\Assigner; +namespace spec\Sylius\CmsPlugin\Assigner; -use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssigner; -use BitBag\SyliusCmsPlugin\Assigner\TaxonsAssignerInterface; -use BitBag\SyliusCmsPlugin\Entity\TaxonAwareInterface; use PhpSpec\ObjectBehavior; +use Sylius\CmsPlugin\Assigner\TaxonsAssigner; +use Sylius\CmsPlugin\Assigner\TaxonsAssignerInterface; +use Sylius\CmsPlugin\Entity\TaxonAwareInterface; use Sylius\Component\Core\Model\TaxonInterface; use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface; @@ -32,10 +32,9 @@ public function it_assigns_taxons( TaxonRepositoryInterface $taxonRepository, TaxonInterface $mugsTaxon, TaxonInterface $stickersTaxon, - TaxonAwareInterface $taxonsAware + TaxonAwareInterface $taxonsAware, ): void { - $taxonRepository->findOneBy(['code' => 'mugs'])->willReturn($mugsTaxon); - $taxonRepository->findOneBy(['code' => 'stickers'])->willReturn($stickersTaxon); + $taxonRepository->findBy(['code' => ['mugs', 'stickers']])->willReturn([$mugsTaxon, $stickersTaxon]); $taxonsAware->addTaxon($mugsTaxon)->shouldBeCalled(); $taxonsAware->addTaxon($stickersTaxon)->shouldBeCalled(); diff --git a/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php b/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php index 380016d16..23ab783fc 100644 --- a/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php +++ b/spec/Controller/Action/Admin/UploadEditorImageActionSpec.php @@ -1,21 +1,15 @@ beConstructedWith($mediaProviderResolver, $mediaRepository, $mediaFactory); } @@ -43,7 +37,7 @@ public function it_uploads_media( FileBag $fileBag, MediaProviderResolverInterface $mediaProviderResolver, ProviderInterface $provider, - MediaRepositoryInterface $mediaRepository + MediaRepositoryInterface $mediaRepository, ): void { $uploadedFile = new UploadedFile(__DIR__ . '/../../../../tests/Behat/Resources/images/aston_martin_db_11.jpg', 'aston_martin_db_11.jpg'); diff --git a/spec/Entity/BlockSpec.php b/spec/Entity/BlockSpec.php index 190db4c18..50835cf1b 100755 --- a/spec/Entity/BlockSpec.php +++ b/spec/Entity/BlockSpec.php @@ -1,22 +1,14 @@ getSubject()->willReturn(Argument::any()); @@ -44,7 +38,7 @@ public function it_uploads_media( ResourceControllerEvent $event, MediaInterface $media, MediaProviderResolverInterface $mediaProviderResolver, - ProviderInterface $provider + ProviderInterface $provider, ): void { $event->getSubject()->willReturn($media); $mediaProviderResolver->resolveProvider($media)->willReturn($provider); diff --git a/spec/Exception/ImportFailedExceptionSpec.php b/spec/Exception/ImportFailedExceptionSpec.php index 15597534d..5f06c02e1 100755 --- a/spec/Exception/ImportFailedExceptionSpec.php +++ b/spec/Exception/ImportFailedExceptionSpec.php @@ -1,17 +1,11 @@ findBy(['code' => $mediaCodes])->willReturn([$media1, $media2]); @@ -63,9 +56,8 @@ public function it_reverse_transforms_empty_collection_to_empty_array(): void public function it_reverse_transforms_collection_to_array_of_media_codes( MediaInterface $media1, - MediaInterface $media2 - ): void - { + MediaInterface $media2, + ): void { $media1->getCode()->willReturn('code1'); $media2->getCode()->willReturn('code2'); diff --git a/spec/Importer/BlockImporterSpec.php b/spec/Importer/BlockImporterSpec.php index 49a754908..9c6566908 100644 --- a/spec/Importer/BlockImporterSpec.php +++ b/spec/Importer/BlockImporterSpec.php @@ -1,27 +1,21 @@ beConstructedWith( $blockResourceResolver, $importerCollectionsResolver, $importerChannelsResolver, - $importerLocalesResolver, $importerProductsResolver, $importerTaxonsResolver, $importerProductsInTaxonsResolver, $validator, - $blockRepository + $blockRepository, ); } @@ -62,15 +53,13 @@ public function it_imports_block( ResourceResolverInterface $blockResourceResolver, ImporterCollectionsResolverInterface $importerCollectionsResolver, ImporterChannelsResolverInterface $importerChannelsResolver, - ImporterLocalesResolverInterface $importerLocalesResolver, ImporterProductsResolverInterface $importerProductsResolver, ImporterTaxonsResolverInterface $importerTaxonsResolver, ImporterProductsInTaxonsResolverInterface $importerProductsInTaxonsResolver, ValidatorInterface $validator, BlockRepositoryInterface $blockRepository, - BlockInterface $block - ) - { + BlockInterface $block, + ) { $row = ['name' => 'block_name', 'code' => 'block_code', 'enabled' => '1']; $blockResourceResolver->getResource('block_code')->willReturn($block); @@ -81,12 +70,11 @@ public function it_imports_block( $importerCollectionsResolver->resolve($block, null)->shouldBeCalled(); $importerChannelsResolver->resolve($block, null)->shouldBeCalled(); - $importerLocalesResolver->resolve($block, null)->shouldBeCalled(); $importerProductsResolver->resolve($block, null)->shouldBeCalled(); $importerTaxonsResolver->resolve($block, null)->shouldBeCalled(); $importerProductsInTaxonsResolver->resolve($block, null)->shouldBeCalled(); - $validator->validate($block, null, ['bitbag'])->willReturn(new ConstraintViolationList()); + $validator->validate($block, null, ['cms'])->willReturn(new ConstraintViolationList()); $blockRepository->add($block)->shouldBeCalled(); diff --git a/spec/Importer/MediaImporterSpec.php b/spec/Importer/MediaImporterSpec.php index c97844c30..14df2cda1 100644 --- a/spec/Importer/MediaImporterSpec.php +++ b/spec/Importer/MediaImporterSpec.php @@ -1,21 +1,14 @@ beConstructedWith( $mediaResourceResolver, @@ -40,8 +33,8 @@ public function let( public function it_is_initializable() { - $this->shouldHaveType(\BitBag\SyliusCmsPlugin\Importer\MediaImporter::class); - $this->shouldImplement(\BitBag\SyliusCmsPlugin\Importer\MediaImporterInterface::class); + $this->shouldHaveType(\Sylius\CmsPlugin\Importer\MediaImporter::class); + $this->shouldImplement(\Sylius\CmsPlugin\Importer\MediaImporterInterface::class); } public function it_imports_media( @@ -50,9 +43,8 @@ public function it_imports_media( ImporterCollectionsResolverInterface $importerCollectionsResolver, ValidatorInterface $validator, MediaRepositoryInterface $mediaRepository, - MediaInterface $media - ) - { + MediaInterface $media, + ) { $row = ['name_pl' => 'name', 'content_pl' => 'content', 'alt_pl' => 'alt', 'code' => 'media_code']; $mediaResourceResolver->getResource('media_code')->willReturn($media); @@ -68,7 +60,7 @@ public function it_imports_media( $importerCollectionsResolver->resolve($media, null)->shouldBeCalled(); - $validator->validate($media, null, ['bitbag'])->willReturn(new ConstraintViolationList()); + $validator->validate($media, null, ['cms'])->willReturn(new ConstraintViolationList()); $mediaRepository->add($media)->shouldBeCalled(); diff --git a/spec/Importer/PageImporterSpec.php b/spec/Importer/PageImporterSpec.php index 86f500c62..6be306720 100644 --- a/spec/Importer/PageImporterSpec.php +++ b/spec/Importer/PageImporterSpec.php @@ -1,26 +1,16 @@ beConstructedWith( $pageResourceResolver, @@ -46,8 +36,8 @@ public function let( public function it_is_initializable() { - $this->shouldHaveType(\BitBag\SyliusCmsPlugin\Importer\PageImporter::class); - $this->shouldImplement(\BitBag\SyliusCmsPlugin\Importer\PageImporterInterface::class); + $this->shouldHaveType(\Sylius\CmsPlugin\Importer\PageImporter::class); + $this->shouldImplement(\Sylius\CmsPlugin\Importer\PageImporterInterface::class); } public function it_imports_page_no_url( @@ -58,8 +48,7 @@ public function it_imports_page_no_url( ValidatorInterface $validator, EntityManagerInterface $entityManager, PageInterface $page, - ) - { + ) { $row = [ 'code' => 'page_code', 'name' => 'page_name', @@ -91,7 +80,7 @@ public function it_imports_page_no_url( $importerCollectionsResolver->resolve($page, 'collections')->shouldBeCalled(); $importerChannelsResolver->resolve($page, 'channels')->shouldBeCalled(); - $validator->validate($page, null, ['bitbag'])->willReturn(new ConstraintViolationList()); + $validator->validate($page, null, ['cms'])->willReturn(new ConstraintViolationList()); $entityManager->persist($page)->shouldBeCalled(); $entityManager->flush()->shouldBeCalled(); diff --git a/spec/MediaProvider/FilenameHelperSpec.php b/spec/MediaProvider/FilenameHelperSpec.php index dd9312bbe..80bdba551 100644 --- a/spec/MediaProvider/FilenameHelperSpec.php +++ b/spec/MediaProvider/FilenameHelperSpec.php @@ -1,18 +1,11 @@ beConstructedWith($uploader, $twigEngine, '@Template', '/media/'); } diff --git a/spec/MediaProvider/GenericProviderSpec.php~refs/remotes/origin/master b/spec/MediaProvider/GenericProviderSpec.php~refs/remotes/origin/master index 098d51d65..c7b9e5dc7 100644 --- a/spec/MediaProvider/GenericProviderSpec.php~refs/remotes/origin/master +++ b/spec/MediaProvider/GenericProviderSpec.php~refs/remotes/origin/master @@ -1,19 +1,13 @@ getMenu()->willReturn($menu); - $menu->addChild('bitbag_cms')->willReturn($cmsRootMenuItem); - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.cms')->willReturn($cmsRootMenuItem); + $menu->addChild('sylius_cms')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.cms')->willReturn($cmsRootMenuItem); $cmsRootMenuItem - ->addChild('blocks', ['route' => 'bitbag_sylius_cms_plugin_admin_block_index']) + ->addChild('blocks', ['route' => 'sylius_cms_admin_block_index']) ->willReturn($cmsRootMenuItem) ; - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.blocks')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.blocks')->willReturn($cmsRootMenuItem); $cmsRootMenuItem->setLabelAttribute('icon', 'block layout')->shouldBeCalled(); $cmsRootMenuItem - ->addChild('pages', ['route' => 'bitbag_sylius_cms_plugin_admin_page_index']) + ->addChild('pages', ['route' => 'sylius_cms_admin_page_index']) ->willReturn($cmsRootMenuItem) ; - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.pages')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.pages')->willReturn($cmsRootMenuItem); $cmsRootMenuItem->setLabelAttribute('icon', 'sticky note')->shouldBeCalled(); $cmsRootMenuItem - ->addChild('collections', ['route' => 'bitbag_sylius_cms_plugin_admin_collection_index']) + ->addChild('collections', ['route' => 'sylius_cms_admin_collection_index']) ->willReturn($cmsRootMenuItem) ; - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.collections')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.collections')->willReturn($cmsRootMenuItem); $cmsRootMenuItem->setLabelAttribute('icon', 'grid layout')->shouldBeCalled(); $cmsRootMenuItem - ->addChild('templates', ['route' => 'bitbag_sylius_cms_plugin_admin_template_index']) + ->addChild('templates', ['route' => 'sylius_cms_admin_template_index']) ->willReturn($cmsRootMenuItem) ; - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.templates')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.templates')->willReturn($cmsRootMenuItem); $cmsRootMenuItem->setLabelAttribute('icon', 'clone')->shouldBeCalled(); $cmsRootMenuItem - ->addChild('media', ['route' => 'bitbag_sylius_cms_plugin_admin_media_index']) + ->addChild('media', ['route' => 'sylius_cms_admin_media_index']) ->willReturn($cmsRootMenuItem) ; - $cmsRootMenuItem->setLabel('bitbag_sylius_cms_plugin.ui.media')->willReturn($cmsRootMenuItem); + $cmsRootMenuItem->setLabel('sylius_cms.ui.media')->willReturn($cmsRootMenuItem); $cmsRootMenuItem->setLabelAttribute('icon', 'file')->shouldBeCalled(); $menu->getChildren()->willReturn(['marketing' => $cmsRootMenuItem]); - $menu->getChild('bitbag_cms')->willReturn($cmsRootMenuItem); + $menu->getChild('sylius_cms')->willReturn($cmsRootMenuItem); - $menu->setChildren(['marketing' => $cmsRootMenuItem, 'bitbag_cms' => $cmsRootMenuItem])->willReturn($menu); + $menu->setChildren(['marketing' => $cmsRootMenuItem, 'sylius_cms' => $cmsRootMenuItem])->willReturn($menu); $this->buildMenu($menuBuilderEvent); } diff --git a/spec/Menu/MenuReorderSpec.php b/spec/Menu/MenuReorderSpec.php index 3eaa8c8cd..b992e9166 100644 --- a/spec/Menu/MenuReorderSpec.php +++ b/spec/Menu/MenuReorderSpec.php @@ -1,20 +1,14 @@ getChildren()->willReturn([ 'item1' => $item1, 'item2' => $item2, - 'item3' => $item3 + 'item3' => $item3, ]); $menu->getChild('item2')->willReturn($item2); @@ -46,7 +39,7 @@ public function it_reorders_menu_items( $menu->setChildren([ 'item1' => $item1, 'item3' => $item3, - 'item2' => $item2 + 'item2' => $item2, ])->shouldBeCalled(); $this->reorder($menu, 'item2', 'item3'); @@ -55,12 +48,11 @@ public function it_reorders_menu_items( public function it_does_not_reorder_if_new_item_is_not_found( ItemInterface $menu, ItemInterface $item1, - ItemInterface $item3 - ): void - { + ItemInterface $item3, + ): void { $menu->getChildren()->willReturn([ 'item1' => $item1, - 'item3' => $item3 + 'item3' => $item3, ]); $menu->getChild('item2')->willReturn(null); @@ -72,12 +64,11 @@ public function it_does_not_reorder_if_new_item_is_not_found( public function it_does_not_reorder_if_target_item_is_not_found( ItemInterface $menu, ItemInterface $item1, - ItemInterface $item2 - ): void - { + ItemInterface $item2, + ): void { $menu->getChildren()->willReturn([ 'item1' => $item1, - 'item2' => $item2 + 'item2' => $item2, ]); $menu->getChild('item1')->willReturn($item1); @@ -89,12 +80,11 @@ public function it_does_not_reorder_if_target_item_is_not_found( public function it_does_not_modify_menu_when_no_reorder_is_needed( ItemInterface $menu, ItemInterface $item1, - ItemInterface $item2 - ): void - { + ItemInterface $item2, + ): void { $menu->getChildren()->willReturn([ 'item1' => $item1, - 'item2' => $item2 + 'item2' => $item2, ]); $menu->getChild('item1')->willReturn($item1); diff --git a/spec/Processor/ImportProcessorSpec.php b/spec/Processor/ImportProcessorSpec.php index b1129d087..9d584c298 100644 --- a/spec/Processor/ImportProcessorSpec.php +++ b/spec/Processor/ImportProcessorSpec.php @@ -1,30 +1,23 @@ beConstructedWith($importerChain, $reader, $entityManager); } @@ -38,7 +31,7 @@ public function it_processes_import_data( ImporterChainInterface $importerChain, ReaderInterface $reader, EntityManagerInterface $entityManager, - ImporterInterface $importer + ImporterInterface $importer, ) { $resourceCode = 'some_resource'; $filePath = 'path/to/file.csv'; @@ -65,7 +58,7 @@ public function it_throws_exception_when_import_fails( ImporterChainInterface $importerChain, ReaderInterface $reader, EntityManagerInterface $entityManager, - ImporterInterface $importer + ImporterInterface $importer, ) { $resourceCode = 'some_resource'; $filePath = 'path/to/file.csv'; diff --git a/spec/Renderer/Collection/CollectionBlocksRendererSpec.php b/spec/Renderer/Collection/CollectionBlocksRendererSpec.php index d131e1cbf..af03a76c6 100644 --- a/spec/Renderer/Collection/CollectionBlocksRendererSpec.php +++ b/spec/Renderer/Collection/CollectionBlocksRendererSpec.php @@ -1,22 +1,16 @@ getWrappedObject(), $block2->getWrappedObject()]); $collection->getBlocks()->willReturn($blocks); @@ -55,9 +48,8 @@ public function it_limits_number_of_rendered_blocks( ContentElementRendererStrategyInterface $contentElementRendererStrategy, CollectionInterface $collection, BlockInterface $block1, - BlockInterface $block2 - ): void - { + BlockInterface $block2, + ): void { $blocks = new ArrayCollection([$block1->getWrappedObject(), $block2->getWrappedObject()]); $collection->getBlocks()->willReturn($blocks); @@ -69,9 +61,8 @@ public function it_limits_number_of_rendered_blocks( public function it_supports_collections_with_blocks( CollectionInterface $collection, - BlockInterface $block - ): void - { + BlockInterface $block, + ): void { $blocks = new ArrayCollection([$block]); $collection->getBlocks()->willReturn($blocks); @@ -79,9 +70,8 @@ public function it_supports_collections_with_blocks( } public function it_does_not_support_empty_collections( - CollectionInterface $collection - ): void - { + CollectionInterface $collection, + ): void { $collection->getBlocks()->willReturn(new ArrayCollection()); $this->supports($collection)->shouldReturn(false); @@ -89,9 +79,8 @@ public function it_does_not_support_empty_collections( public function it_throws_exception_when_blocks_are_null( ContentElementRendererStrategyInterface $contentElementRendererStrategy, - CollectionInterface $collection - ): void - { + CollectionInterface $collection, + ): void { $collection->getBlocks()->willReturn(null); $this->shouldThrow(\InvalidArgumentException::class) diff --git a/spec/Renderer/Collection/CollectionMediaRendererSpec.php b/spec/Renderer/Collection/CollectionMediaRendererSpec.php index d04537038..84ba0b334 100644 --- a/spec/Renderer/Collection/CollectionMediaRendererSpec.php +++ b/spec/Renderer/Collection/CollectionMediaRendererSpec.php @@ -1,22 +1,16 @@ getId()->willReturn(2); $page2->getId()->willReturn(1); @@ -57,9 +50,8 @@ public function it_limits_number_of_rendered_pages( PageLinkRendererInterface $pageLinkRenderer, CollectionInterface $collection, PageInterface $page1, - PageInterface $page2 - ): void - { + PageInterface $page2, + ): void { $page1->getId()->willReturn(2); $page2->getId()->willReturn(1); @@ -73,18 +65,16 @@ public function it_limits_number_of_rendered_pages( public function it_supports_collections_with_pages( CollectionInterface $collection, - PageInterface $page - ): void - { + PageInterface $page, + ): void { $collection->getPages()->willReturn(new ArrayCollection([$page])); $this->supports($collection)->shouldReturn(true); } public function it_does_not_support_empty_collections( - CollectionInterface $collection - ): void - { + CollectionInterface $collection, + ): void { $collection->getPages()->willReturn(new ArrayCollection()); $this->supports($collection)->shouldReturn(false); diff --git a/spec/Renderer/CollectionRendererStrategySpec.php b/spec/Renderer/CollectionRendererStrategySpec.php index 67aebde51..38e250271 100644 --- a/spec/Renderer/CollectionRendererStrategySpec.php +++ b/spec/Renderer/CollectionRendererStrategySpec.php @@ -1,20 +1,14 @@ supports($collection)->willReturn(false); $renderer2->supports($collection)->willReturn(true); $renderer2->render($collection, null)->willReturn('rendered content'); @@ -49,9 +42,8 @@ public function it_renders_collection_using_supported_renderer( public function it_renders_collection_with_count_to_render( CollectionRendererInterface $renderer1, CollectionRendererInterface $renderer2, - CollectionInterface $collection - ): void - { + CollectionInterface $collection, + ): void { $renderer1->supports($collection)->willReturn(false); $renderer2->supports($collection)->willReturn(true); $renderer2->render($collection, 5)->willReturn('rendered content with count'); @@ -62,9 +54,8 @@ public function it_renders_collection_with_count_to_render( public function it_returns_empty_string_when_no_renderer_supports_collection( CollectionRendererInterface $renderer1, CollectionRendererInterface $renderer2, - CollectionInterface $collection - ): void - { + CollectionInterface $collection, + ): void { $renderer1->supports($collection)->willReturn(false); $renderer2->supports($collection)->willReturn(false); diff --git a/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php b/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php index 33b4ecfd5..63e3d71c9 100644 --- a/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/HeadingContentElementRendererSpec.php @@ -1,37 +1,22 @@ beConstructedWith($twig); - } - public function it_is_initializable(): void { $this->shouldHaveType(HeadingContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_heading_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -48,13 +33,17 @@ public function it_does_not_support_other_content_element_types(ContentConfigura public function it_renders_heading_content_element(Environment $twig, ContentConfigurationInterface $contentConfiguration): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ 'heading_type' => 'h1', - 'heading' => 'Sample Heading' + 'heading' => 'Sample Heading', ]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_heading.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'heading_type' => 'h1', 'heading_content' => 'Sample Heading', ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php b/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php index 2f53625d7..bbfae8d24 100644 --- a/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/MultipleMediaContentElementRendererSpec.php @@ -1,44 +1,32 @@ beConstructedWith($twig, $renderMediaRuntime, $mediaRepository); + MediaRepositoryInterface $mediaRepository, + ): void { + $this->beConstructedWith($renderMediaRuntime, $mediaRepository); } public function it_is_initializable(): void { $this->shouldHaveType(MultipleMediaContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_multiple_media_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -59,11 +47,14 @@ public function it_renders_multiple_media_content_element( MediaRepositoryInterface $mediaRepository, ContentConfigurationInterface $contentConfiguration, MediaInterface $media1, - MediaInterface $media2 - ): void - { + MediaInterface $media2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'multiple_media' => ['code1', 'code2'] + 'multiple_media' => ['code1', 'code2'], ]); $mediaRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$media1, $media2]); @@ -74,8 +65,8 @@ public function it_renders_multiple_media_content_element( $renderMediaRuntime->renderMedia('code1')->willReturn('rendered media 1'); $renderMediaRuntime->renderMedia('code2')->willReturn('rendered media 2'); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_multiple_media.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'media' => [ [ 'renderedContent' => 'rendered media 1', diff --git a/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php b/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php index 9810bd310..a44bea055 100644 --- a/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/PagesCollectionContentElementRendererSpec.php @@ -1,41 +1,30 @@ beConstructedWith($twig, $collectionRepository); + $this->beConstructedWith($collectionRepository); } public function it_is_initializable(): void { $this->shouldHaveType(PagesCollectionContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_pages_collection_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -55,10 +44,13 @@ public function it_renders_pages_collection_content_element( CollectionRepositoryInterface $collectionRepository, ContentConfigurationInterface $contentConfiguration, CollectionInterface $collection, - ): void - { + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'pages_collection' => 'collection_code' + 'pages_collection' => 'collection_code', ]); $collectionRepository->findOneBy(['code' => 'collection_code'])->willReturn($collection); @@ -66,9 +58,9 @@ public function it_renders_pages_collection_content_element( $pagesCollection = new ArrayCollection(['page1', 'page2']); $collection->getPages()->willReturn($pagesCollection); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_pages_collection.html.twig', - 'collection' => $pagesCollection + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, + 'collection' => $pagesCollection, ])->willReturn('rendered_output'); $this->render($contentConfiguration)->shouldReturn('rendered_output'); diff --git a/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php index 0d453fcd0..b79c1ff64 100644 --- a/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRendererSpec.php @@ -1,20 +1,14 @@ beConstructedWith($twig, $productRepository, $taxonRepository); + $this->beConstructedWith($productRepository, $taxonRepository); } public function it_is_initializable(): void { $this->shouldHaveType(ProductsCarouselByTaxonContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_products_carousel_by_taxon_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -57,18 +47,21 @@ public function it_renders_products_carousel_by_taxon_content_element( ContentConfigurationInterface $contentConfiguration, TaxonInterface $taxon, Product $product1, - Product $product2 - ): void - { + Product $product2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'products_carousel_by_taxon' => 'taxon_code' + 'products_carousel_by_taxon' => 'taxon_code', ]); $taxonRepository->findOneBy(['code' => 'taxon_code'])->willReturn($taxon); $productRepository->findByTaxon($taxon)->willReturn([$product1, $product2]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'products' => [$product1, $product2], ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php index 38a67b1f5..91a25d747 100644 --- a/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/ProductsCarouselContentElementRendererSpec.php @@ -1,39 +1,29 @@ beConstructedWith($twig, $productRepository); + $this->beConstructedWith($productRepository); } public function it_is_initializable(): void { $this->shouldHaveType(ProductsCarouselContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_products_carousel_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -53,17 +43,20 @@ public function it_renders_products_carousel_content_element( ProductRepositoryInterface $productRepository, ContentConfigurationInterface $contentConfiguration, Product $product1, - Product $product2 - ): void - { + Product $product2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'products_carousel' => ['products' => ['code1', 'code2']] + 'products_carousel' => ['products' => ['code1', 'code2']], ]); $productRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$product1, $product2]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'products' => [$product1, $product2], ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php index 3745ca5d4..000108a5a 100644 --- a/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/ProductsGridByTaxonContentElementRendererSpec.php @@ -1,20 +1,14 @@ beConstructedWith($twig, $productRepository, $taxonRepository); + $this->beConstructedWith($productRepository, $taxonRepository); } public function it_is_initializable(): void { $this->shouldHaveType(ProductsGridByTaxonContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_products_grid_by_taxon_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -57,18 +47,21 @@ public function it_renders_products_grid_by_taxon_content_element( ContentConfigurationInterface $contentConfiguration, TaxonInterface $taxon, Product $product1, - Product $product2 - ): void - { + Product $product2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'products_grid_by_taxon' => 'taxon_code' + 'products_grid_by_taxon' => 'taxon_code', ]); $taxonRepository->findOneBy(['code' => 'taxon_code'])->willReturn($taxon); $productRepository->findByTaxon($taxon)->willReturn([$product1, $product2]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_grid.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'products' => [$product1, $product2], ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php b/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php index f5f012033..0c237bd47 100644 --- a/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/ProductsGridContentElementRendererSpec.php @@ -1,39 +1,29 @@ beConstructedWith($twig, $productRepository); + $this->beConstructedWith($productRepository); } public function it_is_initializable(): void { $this->shouldHaveType(ProductsGridContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_products_grid_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -53,17 +43,20 @@ public function it_renders_products_grid_content_element( ProductRepositoryInterface $productRepository, ContentConfigurationInterface $contentConfiguration, Product $product1, - Product $product2 - ): void - { + Product $product2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'products_grid' => ['products' => ['code1', 'code2']] + 'products_grid' => ['products' => ['code1', 'code2']], ]); $productRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$product1, $product2]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_grid.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'products' => [$product1, $product2], ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php b/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php index 6b0d031e2..d9a08cc23 100644 --- a/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/SingleMediaContentElementRendererSpec.php @@ -1,40 +1,30 @@ beConstructedWith($twig, $renderMediaRuntime, $mediaRepository); + $this->beConstructedWith($renderMediaRuntime, $mediaRepository); } public function it_is_initializable(): void { $this->shouldHaveType(SingleMediaContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_single_media_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -54,18 +44,21 @@ public function it_renders_single_media_content_element( RenderMediaRuntimeInterface $renderMediaRuntime, MediaRepositoryInterface $mediaRepository, ContentConfigurationInterface $contentConfiguration, - MediaInterface $media - ): void - { + MediaInterface $media, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'single_media' => 'media_code' + 'single_media' => 'media_code', ]); $renderMediaRuntime->renderMedia('media_code')->willReturn('rendered media'); $mediaRepository->findOneBy(['code' => 'media_code'])->willReturn($media); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_single_media.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'media' => [ 'renderedContent' => 'rendered media', 'entity' => $media, diff --git a/spec/Renderer/ContentElement/SpacerContentElementRendererSpec.php b/spec/Renderer/ContentElement/SpacerContentElementRendererSpec.php index 435378ec8..79c8acc47 100644 --- a/spec/Renderer/ContentElement/SpacerContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/SpacerContentElementRendererSpec.php @@ -1,37 +1,22 @@ beConstructedWith($twig); - } - public function it_is_initializable(): void { $this->shouldHaveType(SpacerContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_spacer_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -48,12 +33,16 @@ public function it_does_not_support_other_content_element_types(ContentConfigura public function it_renders_spacer_content_element(Environment $twig, ContentConfigurationInterface $contentConfiguration): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ 'spacer' => '40', ]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_spacer.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'spacer_height' => '40', ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php b/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php index 6257c257d..96fd44ea9 100644 --- a/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/TaxonsListContentElementRendererSpec.php @@ -1,39 +1,29 @@ beConstructedWith($twig, $taxonRepository); + $this->beConstructedWith($taxonRepository); } public function it_is_initializable(): void { $this->shouldHaveType(TaxonsListContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_taxons_list_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -53,17 +43,20 @@ public function it_renders_taxons_list_content_element( TaxonRepositoryInterface $taxonRepository, ContentConfigurationInterface $contentConfiguration, Taxon $taxon1, - Taxon $taxon2 - ): void - { + Taxon $taxon2, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'taxons_list' => ['taxons' => ['code1', 'code2']] + 'taxons_list' => ['taxons' => ['code1', 'code2']], ]); $taxonRepository->findBy(['code' => ['code1', 'code2']])->willReturn([$taxon1, $taxon2]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_taxons_list.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'taxons' => [$taxon1, $taxon2], ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php b/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php index ba98eb1b8..208ae2807 100644 --- a/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php +++ b/spec/Renderer/ContentElement/TextareaContentElementRendererSpec.php @@ -1,37 +1,22 @@ beConstructedWith($twig); - } - public function it_is_initializable(): void { $this->shouldHaveType(TextareaContentElementRenderer::class); - } - - public function it_implements_content_element_renderer_interface(): void - { - $this->shouldImplement(ContentElementRendererInterface::class); + $this->shouldBeAnInstanceOf(AbstractContentElement::class); } public function it_supports_textarea_content_element_type(ContentConfigurationInterface $contentConfiguration): void @@ -48,15 +33,18 @@ public function it_does_not_support_other_content_element_types(ContentConfigura public function it_renders_textarea_content_element( Environment $twig, - ContentConfigurationInterface $contentConfiguration - ): void - { + ContentConfigurationInterface $contentConfiguration, + ): void { + $template = 'custom_template'; + $this->setTemplate($template); + $this->setTwigEnvironment($twig); + $contentConfiguration->getConfiguration()->willReturn([ - 'textarea' => 'Textarea content' + 'textarea' => 'Textarea content', ]); - $twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_textarea.html.twig', + $twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $template, 'content' => 'Textarea content', ])->willReturn('rendered template'); diff --git a/spec/Renderer/ContentElementRendererStrategySpec.php b/spec/Renderer/ContentElementRendererStrategySpec.php index 23883e1ae..961471325 100644 --- a/spec/Renderer/ContentElementRendererStrategySpec.php +++ b/spec/Renderer/ContentElementRendererStrategySpec.php @@ -1,39 +1,27 @@ beConstructedWith($contentParser, [$renderer1, $renderer2]); - } - - public function it_is_initializable(): void - { - $this->shouldHaveType(ContentElementRendererStrategy::class); + LocaleContextInterface $localeContext, + ContentElementRendererInterface $renderer, + ): void { + $this->beConstructedWith($contentParser, $localeContext, [$renderer]); } public function it_implements_content_element_renderer_strategy_interface(): void @@ -41,57 +29,59 @@ public function it_implements_content_element_renderer_strategy_interface(): voi $this->shouldImplement(ContentElementRendererStrategyInterface::class); } - public function it_renders_content_elements_using_registered_renderers( + public function it_renders_a_page_content_element_correctly( + PageInterface $page, + ContentConfigurationInterface $contentElement, + LocaleContextInterface $localeContext, + ContentElementRendererInterface $renderer, ContentParserInterface $contentParser, - ContentElementRendererInterface $renderer1, - ContentElementRendererInterface $renderer2, - BlockInterface $block, - ContentConfigurationInterface $contentElement1, - ContentConfigurationInterface $contentElement2 - ): void - { - $block->getContentElements()->willReturn( - new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()]) - ); - - $renderer1->supports($contentElement1)->willReturn(true); - $renderer1->supports($contentElement2)->willReturn(false); - $renderer1->render($contentElement1)->willReturn('Rendered content 1'); - $renderer2->supports($contentElement2)->willReturn(true); - $renderer2->supports($contentElement1)->willReturn(false); - $renderer2->render($contentElement2)->willReturn('Rendered content 2'); + ): void { + $page->getContentElements()->willReturn(new ArrayCollection([$contentElement->getWrappedObject()])); + $localeContext->getLocaleCode()->willReturn('en_US'); + $contentElement->getLocale()->willReturn('en_US'); - $expectedParsedContent = 'Parsed content after rendering'; + $renderer->supports($contentElement)->willReturn(true); + $renderer->render($contentElement)->willReturn('<p>Hello World</p>'); - $contentParser->parse('Rendered content 1Rendered content 2')->willReturn($expectedParsedContent); + $contentParser->parse('

Hello World

')->willReturn('

Hello World

'); - $this->render($block)->shouldReturn($expectedParsedContent); + $this->render($page)->shouldReturn('

Hello World

'); } - public function it_renders_content_elements_using_registered_renderers_for_page( + public function it_skips_content_element_with_non_matching_locale( + BlockInterface $block, + ContentConfigurationInterface $contentElement, + LocaleContextInterface $localeContext, ContentParserInterface $contentParser, - ContentElementRendererInterface $renderer1, - ContentElementRendererInterface $renderer2, - PageInterface $page, - ContentConfigurationInterface $contentElement1, - ContentConfigurationInterface $contentElement2 - ): void - { - $page->getContentElements()->willReturn( - new ArrayCollection([$contentElement1->getWrappedObject(), $contentElement2->getWrappedObject()]) - ); + ): void { + $block->getContentElements()->willReturn(new ArrayCollection([$contentElement])); + $localeContext->getLocaleCode()->willReturn('en_US'); + $contentElement->getLocale()->willReturn('fr_FR'); + + $contentParser->parse('')->willReturn(''); - $renderer1->supports($contentElement1)->willReturn(true); - $renderer1->supports($contentElement2)->willReturn(false); - $renderer1->render($contentElement1)->willReturn('Rendered content 1'); - $renderer2->supports($contentElement2)->willReturn(true); - $renderer2->supports($contentElement1)->willReturn(false); - $renderer2->render($contentElement2)->willReturn('Rendered content 2'); + $this->render($block)->shouldReturn(''); + } + + public function it_renders_only_supported_content_elements( + BlockInterface $block, + ContentConfigurationInterface $supportedElement, + ContentConfigurationInterface $unsupportedElement, + LocaleContextInterface $localeContext, + ContentElementRendererInterface $renderer, + ContentParserInterface $contentParser, + ): void { + $block->getContentElements()->willReturn(new ArrayCollection([$supportedElement->getWrappedObject(), $unsupportedElement->getWrappedObject()])); + $localeContext->getLocaleCode()->willReturn('en_US'); + $supportedElement->getLocale()->willReturn('en_US'); + $unsupportedElement->getLocale()->willReturn('en_US'); - $expectedParsedContent = 'Parsed content after rendering'; + $renderer->supports($supportedElement)->willReturn(true); + $renderer->render($supportedElement)->willReturn('<p>Supported</p>'); + $renderer->supports($unsupportedElement)->willReturn(false); - $contentParser->parse('Rendered content 1Rendered content 2')->willReturn($expectedParsedContent); + $contentParser->parse('

Supported

')->willReturn('

Supported

'); - $this->render($page)->shouldReturn($expectedParsedContent); + $this->render($block)->shouldReturn('

Supported

'); } } diff --git a/spec/Renderer/PageLinkRendererSpec.php b/spec/Renderer/PageLinkRendererSpec.php index 45fb7b5f9..f7d3debf6 100644 --- a/spec/Renderer/PageLinkRendererSpec.php +++ b/spec/Renderer/PageLinkRendererSpec.php @@ -1,19 +1,13 @@ beConstructedWith($urlGenerator, $twig); } @@ -39,23 +33,23 @@ public function it_implements_page_link_renderer_interface(): void public function it_renders_page_link_with_default_template( UrlGeneratorInterface $urlGenerator, Environment $twig, - PageInterface $page + PageInterface $page, ): void { $page->getSlug()->willReturn('page-slug'); $page->getName()->willReturn('Page Name'); $urlGenerator->generate( - 'bitbag_sylius_cms_plugin_shop_page_show', + 'sylius_cms_shop_page_show', ['slug' => 'page-slug'], - UrlGeneratorInterface::ABSOLUTE_URL + UrlGeneratorInterface::ABSOLUTE_URL, )->willReturn('http://example.com/page-slug'); $twig->render( - '@BitBagSyliusCmsPlugin/Shop/Page/link.html.twig', + '@SyliusCmsPlugin/Shop/Page/link.html.twig', [ 'link' => 'http://example.com/page-slug', 'name' => 'Page Name', - ] + ], )->willReturn('Page Name'); $this->render($page)->shouldReturn('Page Name'); @@ -64,15 +58,15 @@ public function it_renders_page_link_with_default_template( public function it_renders_page_link_with_custom_template( UrlGeneratorInterface $urlGenerator, Environment $twig, - PageInterface $page + PageInterface $page, ): void { $page->getSlug()->willReturn('page-slug'); $page->getName()->willReturn('Page Name'); $urlGenerator->generate( - 'bitbag_sylius_cms_plugin_shop_page_show', + 'sylius_cms_shop_page_show', ['slug' => 'page-slug'], - UrlGeneratorInterface::ABSOLUTE_URL + UrlGeneratorInterface::ABSOLUTE_URL, )->willReturn('http://example.com/page-slug'); $twig->render( @@ -80,7 +74,7 @@ public function it_renders_page_link_with_custom_template( [ 'link' => 'http://example.com/page-slug', 'name' => 'Page Name', - ] + ], )->willReturn('Page Name'); $this->render($page, 'custom_template.html.twig')->shouldReturn('Page Name'); diff --git a/spec/Resolver/BlockResourceResolverSpec.php b/spec/Resolver/BlockResourceResolverSpec.php index 55931e0a6..b87eb2060 100755 --- a/spec/Resolver/BlockResourceResolverSpec.php +++ b/spec/Resolver/BlockResourceResolverSpec.php @@ -1,26 +1,18 @@ shouldHaveType(BlockResourceResolverInterface::class); } - public function it_logs_warning_if_block_was_not_found( - BlockRepositoryInterface $blockRepository, - LoggerInterface $logger, - ChannelContextInterface $channelContext, - ChannelInterface $channel - ) { - $channel->getCode()->willReturn('WEB'); - $channelContext->getChannel()->willReturn($channel); - $blockRepository->findEnabledByCode('homepage_banner', 'WEB')->willReturn(null); - - $logger - ->warning(sprintf( - 'Block with "%s" code was not found in the database.', - 'homepage_banner' - )) - ->shouldBeCalled() - ; - - $this->findOrLog('homepage_banner'); - } - - public function it_logs_warning_if_block_was_found_but_it_does_not_have_locale( - BlockRepositoryInterface $blockRepository, - LoggerInterface $logger, - ChannelContextInterface $channelContext, - ChannelInterface $channel, - LocaleContextInterface $localeContext, - LocaleInterface $locale, - RepositoryInterface $localeRepository, - BlockInterface $block - ) { - $channel->getCode()->willReturn('WEB'); - $channelContext->getChannel()->willReturn($channel); - $blockRepository->findEnabledByCode('homepage_banner', 'WEB')->willReturn($block); - $localeContext->getLocaleCode()->willReturn('en_US'); - $locale->getCode()->willReturn('en_US'); - $localeRepository->findOneBy(['code' => 'en_US'])->willReturn($locale); - $block->hasLocale($locale)->willReturn(false); - $block->getLocales()->willReturn(new ArrayCollection(['pl_PL'])); - - $logger - ->warning(sprintf( - 'Block with "%s" code was found in the database, but it does not have "%s" locale.', - 'homepage_banner', - 'en_US' - )) - ->shouldBeCalled() - ; - - $this->findOrLog('homepage_banner'); - } - public function it_returns_block_if_found_in_database( BlockRepositoryInterface $blockRepository, BlockInterface $block, ChannelContextInterface $channelContext, ChannelInterface $channel, - LocaleContextInterface $localeContext, - LocaleInterface $locale, - RepositoryInterface $localeRepository, ) { $channel->getCode()->willReturn('WEB'); $channelContext->getChannel()->willReturn($channel); $blockRepository->findEnabledByCode('homepage_banner', 'WEB')->willReturn($block); - $localeContext->getLocaleCode()->willReturn('en_US'); - $locale->getCode()->willReturn('en_US'); - $localeRepository->findOneBy(['code' => 'en_US'])->willReturn($locale); - $block->hasLocale($locale)->willReturn(true); $this->findOrLog('homepage_banner')->shouldReturn($block); } diff --git a/spec/Resolver/ImporterChannelsResolverSpec.php b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php similarity index 67% rename from spec/Resolver/ImporterChannelsResolverSpec.php rename to spec/Resolver/Importer/ImporterChannelsResolverSpec.php index c4ac903af..38cd5d130 100644 --- a/spec/Resolver/ImporterChannelsResolverSpec.php +++ b/spec/Resolver/Importer/ImporterChannelsResolverSpec.php @@ -1,19 +1,13 @@ assign($collectionable, Argument::any())->shouldNotBeCalled(); diff --git a/spec/Resolver/ImporterLocalesResolverSpec.php b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php similarity index 60% rename from spec/Resolver/ImporterLocalesResolverSpec.php rename to spec/Resolver/Importer/ImporterLocalesResolverSpec.php index ed4b4e619..83d2ca4c7 100644 --- a/spec/Resolver/ImporterLocalesResolverSpec.php +++ b/spec/Resolver/Importer/ImporterLocalesResolverSpec.php @@ -1,19 +1,13 @@ assign($localesAware, ['en_US', 'fr_FR'])->shouldBeCalled(); @@ -39,7 +33,7 @@ public function it_resolves_locales_for_locale_aware_entity( public function it_does_not_assign_locales_when_locales_row_is_empty( LocalesAssignerInterface $localesAssigner, - LocaleAwareInterface $localesAware + LocaleAwareInterface $localesAware, ) { $localesAssigner->assign($localesAware, [])->shouldNotBeCalled(); diff --git a/spec/Resolver/ImporterProductsInTaxonsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php similarity index 62% rename from spec/Resolver/ImporterProductsInTaxonsResolverSpec.php rename to spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php index c1ce51ab4..77fd7b8d5 100644 --- a/spec/Resolver/ImporterProductsInTaxonsResolverSpec.php +++ b/spec/Resolver/Importer/ImporterProductsInTaxonsResolverSpec.php @@ -1,19 +1,13 @@ assign($productsInTaxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled(); @@ -39,7 +33,7 @@ public function it_resolves_taxons_for_products_in_taxons_aware_entity( public function it_does_not_assign_taxons_when_taxons_row_is_null( ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner, - ProductsInTaxonsAwareInterface $productsInTaxonsAware + ProductsInTaxonsAwareInterface $productsInTaxonsAware, ) { $productsInTaxonsAssigner->assign($productsInTaxonsAware, [])->shouldNotBeCalled(); diff --git a/spec/Resolver/ImporterProductsResolverSpec.php b/spec/Resolver/Importer/ImporterProductsResolverSpec.php similarity index 63% rename from spec/Resolver/ImporterProductsResolverSpec.php rename to spec/Resolver/Importer/ImporterProductsResolverSpec.php index 3b3bd5b96..5649e82f2 100644 --- a/spec/Resolver/ImporterProductsResolverSpec.php +++ b/spec/Resolver/Importer/ImporterProductsResolverSpec.php @@ -1,20 +1,14 @@ assign($taxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled(); @@ -39,7 +33,7 @@ public function it_resolves_taxons_for_taxon_aware_entity( public function it_does_not_assign_taxons_when_taxons_row_is_null( TaxonsAssignerInterface $taxonsAssigner, - TaxonAwareInterface $taxonsAware + TaxonAwareInterface $taxonsAware, ) { $taxonsAssigner->assign($taxonsAware, [])->shouldNotBeCalled(); diff --git a/spec/Resolver/MediaProviderResolverSpec.php b/spec/Resolver/MediaProviderResolverSpec.php index 5010793c9..d57e7b57e 100644 --- a/spec/Resolver/MediaProviderResolverSpec.php +++ b/spec/Resolver/MediaProviderResolverSpec.php @@ -1,20 +1,14 @@ getType()->willReturn($mediaType); @@ -45,7 +39,7 @@ public function it_resolves_provider_for_media( } public function it_throws_exception_when_media_type_is_null( - MediaInterface $media + MediaInterface $media, ) { $media->getType()->willReturn(null); diff --git a/spec/Resolver/MediaResourceResolverSpec.php b/spec/Resolver/MediaResourceResolverSpec.php index aa1d4a3c2..fc744b63b 100644 --- a/spec/Resolver/MediaResourceResolverSpec.php +++ b/spec/Resolver/MediaResourceResolverSpec.php @@ -1,24 +1,17 @@ beConstructedWith($mediaRepository, $channelContext, $logger); } @@ -45,7 +38,7 @@ public function it_returns_media_when_found( ChannelContextInterface $channelContext, MediaInterface $media, ChannelInterface $channel, - ) { + ) { $code = 'media_code'; $channelCode = 'ecommerce'; @@ -62,7 +55,7 @@ public function it_logs_warning_and_returns_null_when_media_not_found( ChannelContextInterface $channelContext, LoggerInterface $logger, ChannelInterface $channel, - ) { + ) { $code = 'non_existing_code'; $channelCode = 'ecommerce'; diff --git a/spec/Resolver/PageResourceResolverSpec.php b/spec/Resolver/PageResourceResolverSpec.php index 8911c70c4..61f7920c0 100755 --- a/spec/Resolver/PageResourceResolverSpec.php +++ b/spec/Resolver/PageResourceResolverSpec.php @@ -1,28 +1,21 @@ beConstructedWith($pageRepository, $logger); } @@ -39,14 +32,14 @@ public function it_implements_page_resource_resolver_interface(): void public function it_logs_warning_if_page_was_not_found( PageRepositoryInterface $pageRepository, - LoggerInterface $logger + LoggerInterface $logger, ) { $pageRepository->findOneEnabledByCode('homepage_banner')->willReturn(null); $logger ->warning(sprintf( 'Page with "%s" code was not found in the database.', - 'homepage_banner' + 'homepage_banner', )) ->shouldBeCalled() ; @@ -56,7 +49,7 @@ public function it_logs_warning_if_page_was_not_found( public function it_returns_page_if_found_in_database( PageRepositoryInterface $pageRepository, - PageInterface $page + PageInterface $page, ) { $pageRepository->findOneEnabledByCode('homepage_banner')->willReturn($page); diff --git a/spec/Resolver/ResourceResolverSpec.php b/spec/Resolver/ResourceResolverSpec.php index 74817d9bf..9ce6bea2b 100644 --- a/spec/Resolver/ResourceResolverSpec.php +++ b/spec/Resolver/ResourceResolverSpec.php @@ -1,17 +1,11 @@ beConstructedWith($repository, $factory, 'unique_column'); } @@ -32,7 +26,7 @@ public function it_is_initializable() public function it_returns_existing_resource_from_repository( RepositoryInterface $repository, - ResourceInterface $resource + ResourceInterface $resource, ) { $identifier = 'resource_identifier'; @@ -44,7 +38,7 @@ public function it_returns_existing_resource_from_repository( public function it_creates_new_resource_using_factory( RepositoryInterface $repository, FactoryInterface $factory, - ResourceInterface $newResource + ResourceInterface $newResource, ) { $identifier = 'resource_identifier'; $factoryMethod = 'createNew'; @@ -57,7 +51,7 @@ public function it_creates_new_resource_using_factory( public function it_throws_exception_when_factory_method_not_callable( RepositoryInterface $repository, - FactoryInterface $factory + FactoryInterface $factory, ) { $identifier = 'resource_identifier'; $factoryMethod = 'nonExistingMethod'; diff --git a/spec/Sorter/CollectionsSorterSpec.php b/spec/Sorter/CollectionsSorterSpec.php index 2b0116db2..6a296c90a 100644 --- a/spec/Sorter/CollectionsSorterSpec.php +++ b/spec/Sorter/CollectionsSorterSpec.php @@ -1,23 +1,15 @@ getCode()->willReturn('COLLECTION_CODE'); $page->getCollections()->willReturn(new ArrayCollection([$collection->getWrappedObject()])); @@ -41,28 +33,28 @@ public function it_sorts_collections_with_one_element( $this->sortByCollections([$page])->shouldReturn( [ 'COLLECTION_CODE' => ['collection' => $collection, 0 => $page], - ] + ], ); } public function it_sorts_collections_with_more_elements( - PageInterface $page1, - PageInterface $page2, - PageInterface $page3, + PageInterface $page1, + PageInterface $page2, + PageInterface $page3, CollectionInterface $collection1, CollectionInterface $collection2, - CollectionInterface $collection3 + CollectionInterface $collection3, ): void { $collection1->getCode()->willReturn('COLLECTION_1_CODE'); $collection2->getCode()->willReturn('COLLECTION_2_CODE'); $collection3->getCode()->willReturn('COLLECTION_3_CODE'); $page1->getCollections()->willReturn(new ArrayCollection( - [$collection1->getWrappedObject(), $collection3->getWrappedObject()] + [$collection1->getWrappedObject(), $collection3->getWrappedObject()], )); $page2->getCollections()->willReturn(new ArrayCollection([$collection3->getWrappedObject()])); $page3->getCollections()->willReturn(new ArrayCollection( - [$collection2->getWrappedObject(), $collection1->getWrappedObject()] + [$collection2->getWrappedObject(), $collection1->getWrappedObject()], )); $this->sortByCollections([$page1, $page2, $page3])->shouldReturn( @@ -70,15 +62,15 @@ public function it_sorts_collections_with_more_elements( 'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1, 1 => $page3], 'COLLECTION_3_CODE' => ['collection' => $collection3, 0 => $page1, 1 => $page2], 'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page3], - ] + ], ); } public function it_sorts_collections_with_less_elements( - PageInterface $page1, - PageInterface $page2, + PageInterface $page1, + PageInterface $page2, CollectionInterface $collection1, - CollectionInterface $collection2 + CollectionInterface $collection2, ): void { $collection1->getCode()->willReturn('COLLECTION_1_CODE'); $collection2->getCode()->willReturn('COLLECTION_2_CODE'); @@ -90,7 +82,7 @@ public function it_sorts_collections_with_less_elements( [ 'COLLECTION_1_CODE' => ['collection' => $collection1, 0 => $page1], 'COLLECTION_2_CODE' => ['collection' => $collection2, 0 => $page2], - ] + ], ); } } diff --git a/spec/Twig/Parser/ContentParserSpec.php b/spec/Twig/Parser/ContentParserSpec.php index 96e4fcdd9..665680212 100644 --- a/spec/Twig/Parser/ContentParserSpec.php +++ b/spec/Twig/Parser/ContentParserSpec.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace spec\BitBag\SyliusCmsPlugin\Twig\Parser; +namespace spec\Sylius\CmsPlugin\Twig\Parser; -use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParser; -use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface; -use BitBag\SyliusCmsPlugin\Twig\Runtime\RenderBlockRuntimeInterface; use PhpSpec\ObjectBehavior; +use Sylius\CmsPlugin\Twig\Parser\ContentParser; +use Sylius\CmsPlugin\Twig\Parser\ContentParserInterface; +use Sylius\CmsPlugin\Twig\Runtime\RenderBlockRuntimeInterface; use Twig\Environment; use Twig\TwigFunction; @@ -15,7 +15,7 @@ final class ContentParserSpec extends ObjectBehavior { public function let(Environment $twigEnvironment): void { - $this->beConstructedWith($twigEnvironment, ['bitbag_cms_render_block']); + $this->beConstructedWith($twigEnvironment, ['sylius_cms_render_block']); } public function it_is_initializable(): void @@ -30,35 +30,34 @@ public function it_implements_content_parser_interface(): void public function it_parses_string_function( Environment $twigEnvironment, - RenderBlockRuntimeInterface $renderBlockRuntime + RenderBlockRuntimeInterface $renderBlockRuntime, ): void { - $twigFunctionName = 'bitbag_cms_render_block'; + $twigFunctionName = 'sylius_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']), ]); - $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; + $input = "Let's render! {{ sylius_cms_render_block('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }}"; - $renderBlockRuntime->renderBlock('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); $this->parse($input); } public function it_parses_string_functions( Environment $twigEnvironment, - RenderBlockRuntimeInterface $renderBlockRuntime + RenderBlockRuntimeInterface $renderBlockRuntime, ): void { - - $twigFunctionName = 'bitbag_cms_render_block'; + $twigFunctionName = 'sylius_cms_render_block'; $twigEnvironment->getFunctions()->willReturn([ - $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']) + $twigFunctionName => new TwigFunction($twigFunctionName, [$renderBlockRuntime->getWrappedObject(), 'renderBlock']), ]); - $input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }} - Let's render twice! {{ bitbag_cms_render_block('intro1', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; + $input = "Let's render! {{ sylius_cms_render_block('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }} + Let's render twice! {{ sylius_cms_render_block('intro1', '@SyliusCmsPlugin/Shop/Block/show.html.twig') }}"; - $renderBlockRuntime->renderBlock('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); - $renderBlockRuntime->renderBlock('intro1', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); + $renderBlockRuntime->renderBlock('intro1', '@SyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); $this->parse($input); } diff --git a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php index 69c782e97..f59b06686 100644 --- a/spec/Twig/Runtime/RenderBlockRuntimeSpec.php +++ b/spec/Twig/Runtime/RenderBlockRuntimeSpec.php @@ -1,23 +1,15 @@ beConstructedWith($blockResourceResolver, $templatingEngine, $contentElementRendererStrategy); } @@ -52,7 +44,7 @@ public function it_returns_empty_string_when_block_not_found(BlockResourceResolv public function it_returns_empty_string_when_block_not_displayable_for_taxon( BlockResourceResolverInterface $blockResourceResolver, BlockInterface $block, - TaxonInterface $taxon + TaxonInterface $taxon, ): void { $blockResourceResolver->findOrLog('code')->willReturn($block); $block->canBeDisplayedForTaxon($taxon)->willReturn(false); @@ -63,7 +55,7 @@ public function it_returns_empty_string_when_block_not_displayable_for_taxon( public function it_returns_empty_string_when_block_not_displayable_for_product( BlockResourceResolverInterface $blockResourceResolver, BlockInterface $block, - ProductInterface $product + ProductInterface $product, ): void { $blockResourceResolver->findOrLog('code')->willReturn($block); $block->canBeDisplayedForProduct($product)->willReturn(false); @@ -76,12 +68,12 @@ public function it_renders_block_with_default_template( BlockResourceResolverInterface $blockResourceResolver, Environment $templatingEngine, ContentElementRendererStrategyInterface $contentElementRendererStrategy, - BlockInterface $block + BlockInterface $block, ): void { $blockResourceResolver->findOrLog('code')->willReturn($block); $contentElementRendererStrategy->render($block)->willReturn('rendered content'); - $templatingEngine->render('@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig', [ + $templatingEngine->render('@SyliusCmsPlugin/Shop/Block/show.html.twig', [ 'content' => 'rendered content', 'context' => null, ])->willReturn('rendered block'); @@ -93,7 +85,7 @@ public function it_renders_block_with_custom_template( BlockResourceResolverInterface $blockResourceResolver, Environment $templatingEngine, ContentElementRendererStrategyInterface $contentElementRendererStrategy, - BlockInterface $block + BlockInterface $block, ): void { $blockResourceResolver->findOrLog('code')->willReturn($block); $contentElementRendererStrategy->render($block)->willReturn('rendered content'); diff --git a/spec/Twig/Runtime/RenderContentElementsRuntimeSpec.php b/spec/Twig/Runtime/RenderContentElementsRuntimeSpec.php index 483bb47cb..c5c3eea89 100644 --- a/spec/Twig/Runtime/RenderContentElementsRuntimeSpec.php +++ b/spec/Twig/Runtime/RenderContentElementsRuntimeSpec.php @@ -1,22 +1,14 @@ beConstructedWith($contentParser); } @@ -38,7 +30,7 @@ public function it_implements_render_content_runtime_interface(): void public function it_renders_content( ContentParserInterface $contentParser, - ContentableInterface $contentableResource + ContentableInterface $contentableResource, ): void { $contentParser->parse('content')->willReturn('content'); $contentableResource->getContent()->willReturn('content'); diff --git a/spec/Twig/Runtime/RenderMediaRuntimeSpec.php b/spec/Twig/Runtime/RenderMediaRuntimeSpec.php index f699e23e1..c5ec67b9d 100644 --- a/spec/Twig/Runtime/RenderMediaRuntimeSpec.php +++ b/spec/Twig/Runtime/RenderMediaRuntimeSpec.php @@ -1,30 +1,22 @@ beConstructedWith($mediaProviderResolver, $mediaResourceResolver); } @@ -43,12 +35,12 @@ public function it_renders_media( MediaResourceResolverInterface $mediaResourceResolver, MediaProviderResolverInterface $mediaProviderResolver, ProviderInterface $provider, - MediaInterface $media + MediaInterface $media, ): void { - $mediaResourceResolver->findOrLog('bitbag')->willReturn($media); + $mediaResourceResolver->findOrLog('sylius_cms')->willReturn($media); $provider->render($media, null)->willReturn('content'); $mediaProviderResolver->resolveProvider($media)->willReturn($provider); - $this->renderMedia('bitbag')->shouldReturn('content'); + $this->renderMedia('sylius_cms')->shouldReturn('content'); } } diff --git a/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php b/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php index 39fce9a8c..c2240ca7a 100644 --- a/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php +++ b/spec/Twig/Runtime/RenderPageLinkRuntimeSpec.php @@ -1,22 +1,14 @@ beConstructedWith($pageRepository, $router, 'defaultTemplate'); } @@ -63,7 +55,7 @@ public function it_renders_link_for_code( public function it_gets_link_for_code( RouterInterface $router, PageRepositoryInterface $pageRepository, - PageInterface $page + PageInterface $page, ): void { $code = 'CODE'; $slug = 'SLUG'; @@ -72,13 +64,13 @@ public function it_gets_link_for_code( $pageRepository->findOneEnabledByCode($code)->willReturn($page); $page->getSlug()->willReturn($slug); - $router->generate('bitbag_sylius_cms_plugin_shop_page_show', ['slug' => $slug])->willReturn('link'); + $router->generate('sylius_cms_shop_page_show', ['slug' => $slug])->willReturn('link'); $this->getLinkForCode($code, $options)->shouldReturn('link'); } public function it_returns_not_found_message_when_getting_link_for_code( - LocaleContextInterface $localeContext + LocaleContextInterface $localeContext, ): void { $localeContext->getLocaleCode()->willReturn('en_US'); diff --git a/spec/Twig/Runtime/TranslationFormReduceRuntimeSpec.php b/spec/Twig/Runtime/TranslationFormReduceRuntimeSpec.php new file mode 100644 index 000000000..80822f696 --- /dev/null +++ b/spec/Twig/Runtime/TranslationFormReduceRuntimeSpec.php @@ -0,0 +1,125 @@ +shouldHaveType(TranslationFormReduceRuntime::class); + } + + public function it_reduces_form_to_specified_fields( + FormView $form, + FormView $localeForm, + FormView $slugForm, + FormView $titleForm, + ): void { + $form->children = [ + 'en_US' => $localeForm, + ]; + + $localeForm->children = [ + 'slug' => $slugForm, + 'title' => $titleForm, + 'metaDescription' => new FormView(), + ]; + + $result = $this->reduceTranslationForm($form, ['slug', 'title']); + $result->shouldHaveKey('en_US'); + $result['en_US']->shouldHaveKey('slug'); + $result['en_US']->shouldHaveKey('title'); + $result['en_US']->shouldNotHaveKey('metaDescription'); + } + + public function it_throws_exception_if_field_is_not_found(FormView $form, FormView $localeForm): void + { + $form->children = [ + 'en_US' => $localeForm, + ]; + + $localeForm->children = [ + 'metaDescription' => new FormView(), + ]; + + $this->shouldThrow(\InvalidArgumentException::class)->during('reduceTranslationForm', [$form, ['slug', 'title']]); + } + + public function it_handles_multiple_locales( + FormView $form, + FormView $enLocale, + FormView $deLocale, + FormView $slugForm, + FormView $titleForm, + ): void { + $form->children = [ + 'en_US' => $enLocale, + 'de_DE' => $deLocale, + ]; + + $enLocale->children = [ + 'slug' => $slugForm, + 'title' => $titleForm, + ]; + + $deLocale->children = [ + 'slug' => $slugForm, + 'title' => $titleForm, + ]; + + $result = $this->reduceTranslationForm($form, ['slug', 'title']); + $result->shouldHaveCount(2); + $result['en_US']->shouldHaveKey('slug'); + $result['en_US']->shouldHaveKey('title'); + $result['de_DE']->shouldHaveKey('slug'); + $result['de_DE']->shouldHaveKey('title'); + } + + public function it_throws_exception_if_field_is_not_present_in_multiple_locales( + FormView $form, + FormView $enLocale, + FormView $deLocale, + FormView $slugForm, + ): void { + $form->children = [ + 'en_US' => $enLocale, + 'de_DE' => $deLocale, + ]; + + $enLocale->children = [ + 'slug' => $slugForm, + ]; + + $deLocale->children = [ + 'slug' => $slugForm, + // 'title' is missing in de_DE + ]; + + $this->shouldThrow(\InvalidArgumentException::class)->during('reduceTranslationForm', [$form, ['slug', 'title']]); + } + + public function it_handles_empty_field_array( + FormView $form, + FormView $localeForm, + FormView $slugForm, + FormView $titleForm, + ): void { + $form->children = [ + 'en_US' => $localeForm, + ]; + + $localeForm->children = [ + 'slug' => $slugForm, + 'title' => $titleForm, + ]; + + $result = $this->reduceTranslationForm($form, []); + $result->shouldHaveCount(0); + } +} diff --git a/src/Assigner/ChannelsAssigner.php b/src/Assigner/ChannelsAssigner.php index ababfc15b..c911fca89 100644 --- a/src/Assigner/ChannelsAssigner.php +++ b/src/Assigner/ChannelsAssigner.php @@ -1,14 +1,8 @@ channelRepository->findOneBy(['code' => $channelCode]); + $channels = $this->channelRepository->findBy(['code' => $channelsCodes]); + Assert::allIsInstanceOf($channels, ChannelInterface::class); - Assert::notNull($channel, sprintf('Channel with %s code not found.', $channelCode)); + foreach ($channels as $channel) { $channelsAware->addChannel($channel); } } diff --git a/src/Assigner/ChannelsAssignerInterface.php b/src/Assigner/ChannelsAssignerInterface.php index 4bc3c7731..d44118350 100644 --- a/src/Assigner/ChannelsAssignerInterface.php +++ b/src/Assigner/ChannelsAssignerInterface.php @@ -1,14 +1,8 @@ collectionRepository->findOneBy(['code' => $collectionCode]); + $collections = $this->collectionRepository->findBy(['code' => $collectionsCodes]); + Assert::allIsInstanceOf($collections, CollectionInterface::class); - Assert::notNull($collection, sprintf('Collection with %s code not found.', $collectionCode)); + foreach ($collections as $collection) { $collectionsAware->addCollection($collection); } } diff --git a/src/Assigner/CollectionsAssignerInterface.php b/src/Assigner/CollectionsAssignerInterface.php index 7ad276981..a48e7af97 100644 --- a/src/Assigner/CollectionsAssignerInterface.php +++ b/src/Assigner/CollectionsAssignerInterface.php @@ -1,16 +1,10 @@ localeRepository->findAll(); + $locales = $this->localeRepository->findBy(['code' => $localesCodes]); + Assert::allIsInstanceOf($locales, LocaleInterface::class); - /** @var LocaleInterface $locale */ foreach ($locales as $locale) { - if (in_array($locale->getCode(), $localesCodes, true)) { - $localesAware->addLocale($locale); - } + $localesAware->addLocale($locale); } } } diff --git a/src/Assigner/LocalesAssignerInterface.php b/src/Assigner/LocalesAssignerInterface.php index a189e7776..5d5a3645e 100644 --- a/src/Assigner/LocalesAssignerInterface.php +++ b/src/Assigner/LocalesAssignerInterface.php @@ -1,16 +1,10 @@ productRepository->findOneBy(['code' => $productCode]); + $products = $this->productRepository->findBy(['code' => $productsCodes]); + Assert::allIsInstanceOf($products, ProductInterface::class); - Assert::notNull($product, sprintf('Product with %s code not found.', $productCode)); + foreach ($products as $product) { $productsAware->addProduct($product); } } diff --git a/src/Assigner/ProductsAssignerInterface.php b/src/Assigner/ProductsAssignerInterface.php index b3fb31b89..333cd6383 100644 --- a/src/Assigner/ProductsAssignerInterface.php +++ b/src/Assigner/ProductsAssignerInterface.php @@ -1,16 +1,10 @@ taxonRepository->findOneBy(['code' => $taxonCode]); + $taxons = $this->taxonRepository->findBy(['code' => $taxonCodes]); + Assert::allIsInstanceOf($taxons, TaxonInterface::class); - Assert::notNull($taxon, sprintf('Taxon with %s code not found.', $taxonCode)); + foreach ($taxons as $taxon) { $productsInTaxonsAware->addProductsInTaxon($taxon); } } diff --git a/src/Assigner/ProductsInTaxonsAssignerInterface.php b/src/Assigner/ProductsInTaxonsAssignerInterface.php index 569fc3833..4bf692b76 100644 --- a/src/Assigner/ProductsInTaxonsAssignerInterface.php +++ b/src/Assigner/ProductsInTaxonsAssignerInterface.php @@ -1,16 +1,10 @@ taxonRepository->findOneBy(['code' => $taxonCode]); + $taxons = $this->taxonRepository->findBy(['code' => $taxonCodes]); + Assert::allIsInstanceOf($taxons, TaxonInterface::class); - Assert::notNull($taxon, sprintf('Taxon with %s code not found.', $taxonCode)); + foreach ($taxons as $taxon) { $taxonAware->addTaxon($taxon); } } diff --git a/src/Assigner/TaxonsAssignerInterface.php b/src/Assigner/TaxonsAssignerInterface.php index 3a903587a..736082580 100644 --- a/src/Assigner/TaxonsAssignerInterface.php +++ b/src/Assigner/TaxonsAssignerInterface.php @@ -1,16 +1,10 @@ addCompilerPass(new ImporterCompilerPass()); - $container->addCompilerPass(new MediaProviderPass()); - $container->addCompilerPass(new AuthenticationManagerPolyfillPass()); - } -} diff --git a/src/Command/ImportFromCsvCommand.php b/src/Console/Command/ImportFromCsvCommand.php similarity index 74% rename from src/Command/ImportFromCsvCommand.php rename to src/Console/Command/ImportFromCsvCommand.php index b4008fa28..f5d3f28e0 100644 --- a/src/Command/ImportFromCsvCommand.php +++ b/src/Console/Command/ImportFromCsvCommand.php @@ -1,16 +1,10 @@ setName('bitbag:import:csv') + ->setName('cms:import:csv') ->setDescription('Imports a resource') ->setHelp('This command allows you to import resources from CSV. It takes file path and resource name as parameter.') ->addArgument('resource', InputArgument::REQUIRED, 'Importer resource name.') diff --git a/src/Controller/Action/Admin/ImportDataAction.php b/src/Controller/Action/Admin/ImportDataAction.php index e9164a177..ea21e8512 100644 --- a/src/Controller/Action/Admin/ImportDataAction.php +++ b/src/Controller/Action/Admin/ImportDataAction.php @@ -1,19 +1,13 @@ importProcessor->process($resourceName, $file->getPathname()); - $flashBag->set('success', $this->translator->trans('bitbag_sylius_cms_plugin.ui.successfully_imported')); + $flashBag->set('success', $this->translator->trans('sylius_cms.ui.successfully_imported')); } catch (ImportFailedException $exception) { $flashBag->set('error', $exception->getMessage()); } @@ -66,7 +60,7 @@ public function __invoke(Request $request): Response return new RedirectResponse($referer); } - return new Response($this->twig->render('@BitBagSyliusCmsPlugin/Grid/Form/_importForm.html.twig', [ + return new Response($this->twig->render('@SyliusCmsPlugin/Grid/Form/_importForm.html.twig', [ 'form' => $form->createView(), ])); } diff --git a/src/Controller/Action/Admin/ProductSearchAction.php b/src/Controller/Action/Admin/ProductSearchAction.php index feb882ef6..e8fff2e69 100644 --- a/src/Controller/Action/Admin/ProductSearchAction.php +++ b/src/Controller/Action/Admin/ProductSearchAction.php @@ -1,14 +1,8 @@ getScheme(), $request->getHttpHost()), )); - } catch (\Exception $exception) { + } catch (\Exception) { return new Response('', Response::HTTP_BAD_REQUEST); } diff --git a/src/Controller/Action/Admin/TaxonSearchAction.php b/src/Controller/Action/Admin/TaxonSearchAction.php index 8e8883700..728a259a7 100644 --- a/src/Controller/Action/Admin/TaxonSearchAction.php +++ b/src/Controller/Action/Admin/TaxonSearchAction.php @@ -1,14 +1,8 @@ templateRepository->find($id); + if (null === $template) { + return new JsonResponse([ + 'status' => 'error', + 'message' => 'Template not found', + ]); + } + + return new JsonResponse([ + 'status' => 'success', + 'content' => $template->getContentElements(), + ]); + } +} diff --git a/src/Controller/Action/Admin/UploadEditorImageAction.php b/src/Controller/Action/Admin/UploadEditorImageAction.php index d45b500b5..84a6e7c71 100644 --- a/src/Controller/Action/Admin/UploadEditorImageAction.php +++ b/src/Controller/Action/Admin/UploadEditorImageAction.php @@ -1,18 +1,12 @@ get('code'); /** @var BlockResourceResolverInterface $blockResourceResolver */ - $blockResourceResolver = $this->get('bitbag_sylius_cms_plugin.resolver.block_resource'); + $blockResourceResolver = $this->get('sylius_cms.resolver.block_resource'); $block = $blockResourceResolver->findOrLog($code); if (null === $block) { diff --git a/src/Controller/Helper/FormErrorsFlashHelper.php b/src/Controller/Helper/FormErrorsFlashHelper.php index ab03bedc8..5ec6ef61f 100644 --- a/src/Controller/Helper/FormErrorsFlashHelper.php +++ b/src/Controller/Helper/FormErrorsFlashHelper.php @@ -1,14 +1,8 @@ getMessage(); } - $message = $this->translator->trans('bitbag_sylius_cms_plugin.ui.form_was_submitted_with_errors') . ' ' . rtrim(implode(' ', $errors)); + $message = $this->translator->trans('sylius_cms.ui.form_was_submitted_with_errors') . ' ' . rtrim(implode(' ', $errors)); $session = $this->requestStack->getSession()->getFlashBag(); $session->set('error', $message); diff --git a/src/Controller/Helper/FormErrorsFlashHelperInterface.php b/src/Controller/Helper/FormErrorsFlashHelperInterface.php index 99aa53283..e12a85c10 100644 --- a/src/Controller/Helper/FormErrorsFlashHelperInterface.php +++ b/src/Controller/Helper/FormErrorsFlashHelperInterface.php @@ -1,14 +1,8 @@ getMimeType()); Assert::notNull($media->getType()); - if (1 === preg_match("/image\//", $media->getMimeType()) && 'image' === $media->getType()) { + if ('image' === $media->getType() && 1 === preg_match("/image\//", $media->getMimeType())) { $this->setPathForImageMediaType($media); } else { $this->setPathForNonImageMediaType($media); diff --git a/src/Controller/TemplateController.php b/src/Controller/TemplateController.php deleted file mode 100644 index 1c525ff57..000000000 --- a/src/Controller/TemplateController.php +++ /dev/null @@ -1,34 +0,0 @@ -getDoctrine()->getRepository(TemplateInterface::class)->find($id); - if (null === $template) { - return new JsonResponse([ - 'status' => 'error', - 'message' => 'Template not found', - ]); - } - - return new JsonResponse([ - 'status' => 'success', - 'content' => $template->getContentElements(), - ]); - } -} diff --git a/src/DependencyInjection/BitBagSyliusCmsExtension.php b/src/DependencyInjection/BitBagSyliusCmsExtension.php deleted file mode 100755 index f22888356..000000000 --- a/src/DependencyInjection/BitBagSyliusCmsExtension.php +++ /dev/null @@ -1,45 +0,0 @@ -prependDoctrineMigrations($container); - } - - protected function getMigrationsNamespace(): string - { - return 'BitBag\SyliusCmsPlugin\Migrations'; - } - - protected function getMigrationsDirectory(): string - { - return '@BitBagSyliusCmsPlugin/Migrations'; - } - - protected function getNamespacesOfMigrationsExecutedBefore(): array - { - return ['Sylius\Bundle\CoreBundle\Migrations']; - } -} diff --git a/src/DependencyInjection/Compiler/AuthenticationManagerPolyfillPass.php b/src/DependencyInjection/Compiler/AuthenticationManagerPolyfillPass.php deleted file mode 100644 index 239ad5fde..000000000 --- a/src/DependencyInjection/Compiler/AuthenticationManagerPolyfillPass.php +++ /dev/null @@ -1,21 +0,0 @@ -has('security.authentication_manager') && - true === $container->has('security.authentication.manager') - ) { - $container->setAlias('security.authentication_manager', 'security.authentication.manager'); - } - } -} diff --git a/src/DependencyInjection/Compiler/ContentElementPass.php b/src/DependencyInjection/Compiler/ContentElementPass.php new file mode 100644 index 000000000..685584139 --- /dev/null +++ b/src/DependencyInjection/Compiler/ContentElementPass.php @@ -0,0 +1,57 @@ +findTaggedServiceIds('sylius_cms.content_element') as $id => $attributes) { + if (!isset($attributes[0]['template'])) { + throw new \InvalidArgumentException( + sprintf('Tagged content element "%s" needs to have `template` attribute.', $id), + ); + } + + $definition = $container->getDefinition($id); + $definition->addMethodCall('setTemplate', [$attributes[0]['template']]); + $definition->addMethodCall('setTwigEnvironment', [new Reference('twig')]); + + if (isset($attributes[0]['form_type'])) { + $this->registerFormTypeService($container, $attributes[0]['form_type']); + } + } + } + + private function retrieveElementNameConstantFromFormType(string $formType): string + { + if (!class_exists($formType)) { + throw new \InvalidArgumentException(sprintf('Form type "%s" does not exist.', $formType)); + } + + if (!defined($formType . '::TYPE')) { + throw new \InvalidArgumentException(sprintf('Form type "%s" needs to have "TYPE" constant.', $formType)); + } + + return constant(sprintf('%s::TYPE', $formType)); + } + + private function registerFormTypeService(ContainerBuilder $container, string $formType): void + { + $elementName = $this->retrieveElementNameConstantFromFormType($formType); + $formTypeDefinition = new Definition($formType); + $formTypeDefinition->addTag('form.type'); + $formTypeDefinition->addTag('sylius_cms.content_elements.type', [ + 'key' => $elementName, + ]); + + $container->setDefinition('sylius_cms.form.type.content_element.' . $elementName, $formTypeDefinition); + } +} diff --git a/src/DependencyInjection/Compiler/ImporterCompilerPass.php b/src/DependencyInjection/Compiler/ImporterCompilerPass.php index 7379c5ded..53b2645a3 100644 --- a/src/DependencyInjection/Compiler/ImporterCompilerPass.php +++ b/src/DependencyInjection/Compiler/ImporterCompilerPass.php @@ -1,27 +1,21 @@ has('bitbag_sylius_cms_plugin.importer.chain')) { + if (!$container->has('sylius_cms.importer.chain')) { return; } @@ -31,7 +25,7 @@ public function process(ContainerBuilder $container): void ; $taggedServices = $container->findTaggedServiceIds(self::TAG_ID); - $definition = $container->findDefinition('bitbag_sylius_cms_plugin.importer.chain'); + $definition = $container->findDefinition('sylius_cms.importer.chain'); foreach ($taggedServices as $id => $tags) { $definition->addMethodCall('addImporter', [new Reference($id)]); diff --git a/src/DependencyInjection/Compiler/MediaProviderPass.php b/src/DependencyInjection/Compiler/MediaProviderPass.php index 5e8c80962..80c375fa0 100644 --- a/src/DependencyInjection/Compiler/MediaProviderPass.php +++ b/src/DependencyInjection/Compiler/MediaProviderPass.php @@ -1,14 +1,8 @@ hasDefinition('bitbag_sylius_cms_plugin.registry.media_provider')) { + if (!$container->hasDefinition('sylius_cms.registry.media_provider')) { return; } - $providerRegistry = $container->getDefinition('bitbag_sylius_cms_plugin.registry.media_provider'); + $providerRegistry = $container->getDefinition('sylius_cms.registry.media_provider'); $providers = []; - foreach ($container->findTaggedServiceIds('bitbag_sylius_cms_plugin.media_provider') as $id => $attributes) { - if (!isset($attributes[0]['type']) || !isset($attributes[0]['label'])) { + foreach ($container->findTaggedServiceIds('sylius_cms.media_provider') as $id => $attributes) { + if (!isset($attributes[0]['type'], $attributes[0]['label'])) { throw new \InvalidArgumentException('Tagged media provider needs to have `type` and `label` attribute.'); } @@ -40,6 +34,6 @@ public function process(ContainerBuilder $container): void ksort($providers); - $container->setParameter('bitbag_sylius_cms_plugin.media_providers', $providers); + $container->setParameter('sylius_cms.media_providers', $providers); } } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php new file mode 100644 index 000000000..9f30f0f0d --- /dev/null +++ b/src/DependencyInjection/Configuration.php @@ -0,0 +1,199 @@ +getRootNode(); + + $this->addResourcesSection($rootNode); + + return $treeBuilder; + } + + private function addResourcesSection(ArrayNodeDefinition $node): void + { + $node + ->children() + ->arrayNode('resources') + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('block') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(Block::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(BlockInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(BlockController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(BlockRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(BlockType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('collection') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(Collection::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(CollectionInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(CollectionRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(CollectionType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('content_configuration') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(ContentConfiguration::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(ContentConfigurationInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(ContentConfigurationRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(ContentConfigurationType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('media') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(Media::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(MediaInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(MediaController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(MediaRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(MediaType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('translation') + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(MediaTranslation::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(MediaTranslationInterface::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('page') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(Page::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(PageInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(PageController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(PageRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(PageType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('translation') + ->addDefaultsIfNotSet() + ->children() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(PageTranslation::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(PageTranslationInterface::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->arrayNode('template') + ->addDefaultsIfNotSet() + ->children() + ->variableNode('options')->end() + ->arrayNode('classes') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('model')->defaultValue(Template::class)->cannotBeEmpty()->end() + ->scalarNode('interface')->defaultValue(TemplateInterface::class)->cannotBeEmpty()->end() + ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() + ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() + ->scalarNode('repository')->defaultValue(TemplateRepository::class)->cannotBeEmpty()->end() + ->scalarNode('form')->defaultValue(TemplateType::class)->cannotBeEmpty()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ; + } +} diff --git a/src/DependencyInjection/SyliusCmsExtension.php b/src/DependencyInjection/SyliusCmsExtension.php new file mode 100755 index 000000000..e90431477 --- /dev/null +++ b/src/DependencyInjection/SyliusCmsExtension.php @@ -0,0 +1,53 @@ +getCurrentConfiguration($container); + + $this->registerResources('sylius_cms', 'doctrine/orm', $config['resources'], $container); + + $this->prependDoctrineMigrations($container); + } + + protected function getMigrationsNamespace(): string + { + return 'Sylius\CmsPlugin\Migrations'; + } + + protected function getMigrationsDirectory(): string + { + return '@SyliusCmsPlugin/Migrations'; + } + + protected function getNamespacesOfMigrationsExecutedBefore(): array + { + return ['Sylius\Bundle\CoreBundle\Migrations']; + } + + private function getCurrentConfiguration(ContainerBuilder $container): array + { + /** @var ConfigurationInterface $configuration */ + $configuration = $this->getConfiguration([], $container); + $configs = $container->getExtensionConfig($this->getAlias()); + + return $this->processConfiguration($configuration, $configs); + } +} diff --git a/src/Doctrine/ORM/Extension/EnabledAndAvailableExtension.php b/src/Doctrine/ORM/Extension/EnabledAndAvailableExtension.php new file mode 100644 index 000000000..6f69d8c66 --- /dev/null +++ b/src/Doctrine/ORM/Extension/EnabledAndAvailableExtension.php @@ -0,0 +1,69 @@ +addEnabledAndChannelCondition($queryBuilder, $queryNameGenerator, $resourceClass); + } + + public function applyToItem( + QueryBuilder $queryBuilder, + QueryNameGeneratorInterface $queryNameGenerator, + string $resourceClass, + array $identifiers, + Operation $operation = null, + array $context = [], + ): void { + $this->addEnabledAndChannelCondition($queryBuilder, $queryNameGenerator, $resourceClass); + } + + private function addEnabledAndChannelCondition(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass): void + { + $rootAlias = $queryBuilder->getRootAliases()[0]; + + $user = $this->userContext->getUser(); + if (null !== $user && in_array('ROLE_API_ACCESS', $user->getRoles(), true)) { + return; + } + + if (in_array(ToggleableInterface::class, (array) class_implements($resourceClass), true)) { + $queryBuilder + ->andWhere(sprintf('%s.enabled = :enabled', $rootAlias)) + ->setParameter('enabled', true); + } + + if (in_array(ChannelsAwareInterface::class, (array) class_implements($resourceClass), true)) { + $channelAlias = $queryNameGenerator->generateJoinAlias('channel'); + $queryBuilder + ->innerJoin(sprintf('%s.channels', $rootAlias), $channelAlias) + ->andWhere(sprintf('%s.code = :channel', $channelAlias)) + ->setParameter('channel', $this->channelContext->getChannel()->getCode()); + } + } +} diff --git a/src/Downloader/ImageDownloader.php b/src/Downloader/ImageDownloader.php deleted file mode 100644 index 93743c481..000000000 --- a/src/Downloader/ImageDownloader.php +++ /dev/null @@ -1,39 +0,0 @@ -filesystem->dumpFile($path, $contents); - - return new UploadedFile($path, $originalName); - } -} diff --git a/src/Downloader/ImageDownloaderInterface.php b/src/Downloader/ImageDownloaderInterface.php deleted file mode 100644 index f483dbf69..000000000 --- a/src/Downloader/ImageDownloaderInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -initializeCollectionsCollection(); $this->initializeChannelsCollection(); $this->initializeContentElementsCollection(); - $this->initializeLocalesCollection(); $this->initializeProductsCollection(); $this->initializeTaxonCollection(); $this->initializeProductsInTaxonsCollection(); diff --git a/src/Entity/BlockInterface.php b/src/Entity/BlockInterface.php index d0e9d8bee..d3deca301 100755 --- a/src/Entity/BlockInterface.php +++ b/src/Entity/BlockInterface.php @@ -1,14 +1,8 @@ configuration = $configuration; } + public function getLocale(): ?string + { + return $this->locale; + } + + public function setLocale(?string $locale): void + { + $this->locale = $locale; + } + public function getBlock(): ?BlockInterface { return $this->block; @@ -68,13 +72,4 @@ public function setPage(?PageInterface $page): void { $this->page = $page; } - - public function getContent(): ?string - { - if (TextareaContentElementType::TYPE === $this->type) { - return $this->configuration[TextareaContentElementType::TYPE] ?? null; - } - - return null; - } } diff --git a/src/Entity/ContentConfigurationInterface.php b/src/Entity/ContentConfigurationInterface.php index bdbff2041..b593a3c2c 100644 --- a/src/Entity/ContentConfigurationInterface.php +++ b/src/Entity/ContentConfigurationInterface.php @@ -1,20 +1,12 @@ saveWithOriginalName = $saveWithOriginalName; } - /** - * @return MediaTranslationInterface|TranslationInterface - */ protected function getMediaTranslation(): TranslationInterface { return $this->getTranslation(); diff --git a/src/Entity/MediaCollectionInterface.php b/src/Entity/MediaCollectionInterface.php index 45c1dd98e..55344601a 100644 --- a/src/Entity/MediaCollectionInterface.php +++ b/src/Entity/MediaCollectionInterface.php @@ -1,14 +1,8 @@ setMetaDescription($metaDescription); } + public function getTeaserTitle(): ?string + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + + return $pageTranslationInterface->getTeaserTitle(); + } + + public function setTeaserTitle(?string $teaserTitle): void + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + $pageTranslationInterface->setTeaserTitle($teaserTitle); + } + + public function getTeaserContent(): ?string + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + + return $pageTranslationInterface->getTeaserContent(); + } + + public function setTeaserContent(?string $teaserContent): void + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + $pageTranslationInterface->setTeaserContent($teaserContent); + } + + public function getTeaserImage(): ?MediaInterface + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + + return $pageTranslationInterface->getTeaserImage(); + } + + public function setTeaserImage(?MediaInterface $teaserImage): void + { + /** @var PageTranslationInterface $pageTranslationInterface */ + $pageTranslationInterface = $this->getPageTranslation(); + $pageTranslationInterface->setTeaserImage($teaserImage); + } + public function getName(): ?string { return $this->name; @@ -149,9 +186,6 @@ public function setPublishAt(?\DateTimeImmutable $publishAt): void $this->publishAt = $publishAt; } - /** - * @return PageTranslationInterface|TranslationInterface - */ protected function getPageTranslation(): TranslationInterface { return $this->getTranslation(); diff --git a/src/Entity/PageInterface.php b/src/Entity/PageInterface.php index a4cd46275..c3aafb986 100755 --- a/src/Entity/PageInterface.php +++ b/src/Entity/PageInterface.php @@ -1,14 +1,8 @@ setLocale($locale ?? 'en_US'); + $contentConfiguration->setType('heading'); + $contentConfiguration->setConfiguration([ + 'heading_type' => $headingType ?? 'h1', + 'heading' => $headingContent, + ]); + + return $contentConfiguration; + } + + public static function createTextareaContentElement(?string $locale, ?string $content): ?ContentConfiguration + { + if (null === $content) { + return null; + } + + $contentConfiguration = new ContentConfiguration(); + $contentConfiguration->setLocale($locale ?? 'en_US'); + $contentConfiguration->setType('textarea'); + $contentConfiguration->setConfiguration([ + 'textarea' => $content, + ]); + + return $contentConfiguration; + } + + public static function createProductsGridContentElement(?string $locale, ?string $codes): ?ContentConfiguration + { + if (null === $codes) { + return null; + } + + $productsCodes = explode(',', $codes); + $productsCodes = array_map(static function (string $element): string { + return trim($element); + }, $productsCodes); + + $contentConfiguration = new ContentConfiguration(); + $contentConfiguration->setLocale($locale ?? 'en_US'); + $contentConfiguration->setType('products_grid'); + $contentConfiguration->setConfiguration([ + 'products_grid' => [ + 'products' => $productsCodes, + ], + ]); + + return $contentConfiguration; + } + + public static function createSingleMediaContentElement(?string $locale, ?string $code): ?ContentConfiguration + { + if (null === $code) { + return null; + } + + $contentConfiguration = new ContentConfiguration(); + $contentConfiguration->setLocale($locale ?? 'en_US'); + $contentConfiguration->setType('single_media'); + $contentConfiguration->setConfiguration([ + 'single_media' => $code, + ]); + + return $contentConfiguration; + } +} diff --git a/src/Fixture/BlockFixture.php b/src/Fixture/BlockFixture.php index e499c3092..46ebb4bba 100755 --- a/src/Fixture/BlockFixture.php +++ b/src/Fixture/BlockFixture.php @@ -1,17 +1,11 @@ booleanNode('enabled')->defaultTrue()->end() ->arrayNode('collections')->scalarPrototype()->end()->end() ->arrayNode('channels')->scalarPrototype()->end()->end() - ->arrayNode('locales')->scalarPrototype()->end()->end() ->arrayNode('products')->scalarPrototype()->end()->end() ->arrayNode('taxons')->scalarPrototype()->end()->end() ->arrayNode('products_in_taxons')->scalarPrototype()->end()->end() ->arrayNode('content_elements') - ->useAttributeAsKey('key') + ->useAttributeAsKey('locale') + ->arrayPrototype() + ->useAttributeAsKey('key') ->arrayPrototype() ->children() ->scalarNode('type')->end() @@ -60,7 +55,6 @@ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void ->scalarNode('products_carousel_by_taxon')->end() ->scalarNode('products_grid_by_taxon')->end() ->scalarNode('pages_collection')->end() - ->scalarNode('pages_collection')->end() ->scalarNode('spacer')->end() ->arrayNode('multiple_media')->scalarPrototype()->end()->end() ->arrayNode('products_grid') diff --git a/src/Fixture/CollectionFixture.php b/src/Fixture/CollectionFixture.php index 88f963f27..907e3544a 100755 --- a/src/Fixture/CollectionFixture.php +++ b/src/Fixture/CollectionFixture.php @@ -1,17 +1,11 @@ collectionsAssigner->assign($block, $blockData['collections']); $this->channelAssigner->assign($block, $blockData['channels']); - $this->localesAssigner->assign($block, $blockData['locales']); $this->productsAssigner->assign($block, $blockData['products']); $this->taxonsAssigner->assign($block, $blockData['taxons']); $this->productsInTaxonsAssigner->assign($block, $blockData['products_in_taxons']); - foreach ($blockData['content_elements'] as $data) { - $data['data'] = array_filter($data['data'], static function ($value) { - return !empty($value); - }); + foreach ($blockData['content_elements'] as $locale => $data) { + foreach ($data as $contentElementData) { + $contentElementData['data'] = array_filter($contentElementData['data'], static function ($value) { + return !empty($value); + }); - $contentConfiguration = new ContentConfiguration(); - $contentConfiguration->setType($data['type']); - $contentConfiguration->setConfiguration($data['data']); - $contentConfiguration->setBlock($block); - $block->addContentElement($contentConfiguration); + $contentConfiguration = new ContentConfiguration(); + $contentConfiguration->setType($contentElementData['type']); + $contentConfiguration->setConfiguration($contentElementData['data']); + $contentConfiguration->setLocale($locale); + $contentConfiguration->setBlock($block); + $block->addContentElement($contentConfiguration); + } } $this->blockRepository->add($block); diff --git a/src/Fixture/Factory/CollectionFixtureFactory.php b/src/Fixture/Factory/CollectionFixtureFactory.php index 253d92bcb..48e7605bb 100755 --- a/src/Fixture/Factory/CollectionFixtureFactory.php +++ b/src/Fixture/Factory/CollectionFixtureFactory.php @@ -1,19 +1,13 @@ setName($pageData['name']); $page->setEnabled($pageData['enabled']); - /** @var MediaInterface|null $mediaImage */ - $mediaImage = $this->mediaRepository->findOneBy(['code' => $pageData['teaser_image']]); - if ($mediaImage) { - $page->setTeaserImage($mediaImage); - } - - $page->setTeaserTitle($pageData['teaser_title']); - $page->setTeaserContent($pageData['teaser_content']); - foreach ($pageData['translations'] as $localeCode => $translation) { /** @var PageTranslationInterface $pageTranslation */ $pageTranslation = $this->pageTranslationFactory->createNew(); @@ -81,20 +66,31 @@ private function createPage( $pageTranslation->setTitle($translation['meta_title']); $pageTranslation->setMetaKeywords($translation['meta_keywords']); $pageTranslation->setMetaDescription($translation['meta_description']); + $pageTranslation->setTeaserTitle($translation['teaser_title']); + $pageTranslation->setTeaserContent($translation['teaser_content']); + + /** @var MediaInterface|null $mediaImage */ + $mediaImage = $this->mediaRepository->findOneBy(['code' => $translation['teaser_image']]); + if ($mediaImage) { + $pageTranslation->setTeaserImage($mediaImage); + } $page->addTranslation($pageTranslation); } - foreach ($pageData['content_elements'] as $data) { - $data['data'] = array_filter($data['data'], static function ($value) { - return !empty($value); - }); - - $contentConfiguration = new ContentConfiguration(); - $contentConfiguration->setType($data['type']); - $contentConfiguration->setConfiguration($data['data']); - $contentConfiguration->setPage($page); - $page->addContentElement($contentConfiguration); + foreach ($pageData['content_elements'] as $locale => $data) { + foreach ($data as $contentElementData) { + $contentElementData['data'] = array_filter($contentElementData['data'], static function ($value) { + return !empty($value); + }); + + $contentConfiguration = new ContentConfiguration(); + $contentConfiguration->setType($contentElementData['type']); + $contentConfiguration->setConfiguration($contentElementData['data']); + $contentConfiguration->setLocale($locale); + $contentConfiguration->setPage($page); + $page->addContentElement($contentConfiguration); + } } $this->pageRepository->add($page); diff --git a/src/Fixture/Factory/TemplateFixtureFactory.php b/src/Fixture/Factory/TemplateFixtureFactory.php index 4d4ffa7bb..4a9bbd051 100755 --- a/src/Fixture/Factory/TemplateFixtureFactory.php +++ b/src/Fixture/Factory/TemplateFixtureFactory.php @@ -1,16 +1,10 @@ scalarNode('name')->end() ->arrayNode('collections')->scalarPrototype()->end()->end() ->arrayNode('channels')->scalarPrototype()->end()->end() - ->scalarNode('teaser_title')->defaultNull()->end() - ->scalarNode('teaser_content')->defaultNull()->end() - ->scalarNode('teaser_image')->defaultNull()->end() ->arrayNode('translations') ->prototype('array') ->children() @@ -52,11 +43,16 @@ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void ->scalarNode('meta_title')->defaultNull()->end() ->scalarNode('meta_keywords')->defaultNull()->end() ->scalarNode('meta_description')->defaultNull()->end() + ->scalarNode('teaser_title')->defaultNull()->end() + ->scalarNode('teaser_content')->defaultNull()->end() + ->scalarNode('teaser_image')->defaultNull()->end() ->end() ->end() ->end() ->arrayNode('content_elements') - ->useAttributeAsKey('key') + ->useAttributeAsKey('locale') + ->arrayPrototype() + ->useAttributeAsKey('key') ->arrayPrototype() ->children() ->scalarNode('type')->end() diff --git a/src/Fixture/TemplateFixture.php b/src/Fixture/TemplateFixture.php index 5cfdc9b62..056895bb0 100755 --- a/src/Fixture/TemplateFixture.php +++ b/src/Fixture/TemplateFixture.php @@ -1,17 +1,11 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.template', + 'resource' => 'sylius_cms.template', 'choice_name' => 'name', 'choice_value' => 'id', ]); diff --git a/src/Form/Type/BlockAutocompleteChoiceType.php b/src/Form/Type/BlockAutocompleteChoiceType.php index f99a4a6fc..3dc7139a7 100644 --- a/src/Form/Type/BlockAutocompleteChoiceType.php +++ b/src/Form/Type/BlockAutocompleteChoiceType.php @@ -1,14 +1,8 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.block', + 'resource' => 'sylius_cms.block', 'choice_name' => 'name', 'choice_value' => 'code', ]); @@ -38,7 +32,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_block_autocomplete_choice'; + return 'sylius_block_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/BlockType.php b/src/Form/Type/BlockType.php index 6713a45cf..497d8f21c 100755 --- a/src/Form/Type/BlockType.php +++ b/src/Form/Type/BlockType.php @@ -1,27 +1,40 @@ localeRepository->findAll(); + foreach ($locales as $locale) { + $this->locales[$locale->getName()] = $locale->getCode(); + } + } + public function buildForm(FormBuilderInterface $builder, array $options): void { /** @var BlockInterface $block */ @@ -29,26 +42,25 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder ->add('code', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.code', + 'label' => 'sylius_cms.ui.code', 'disabled' => null !== $block->getCode(), ]) ->add('name', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.name', + 'label' => 'sylius_cms.ui.name', ]) ->add('collections', CollectionAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.collections', + 'label' => 'sylius_cms.ui.collections', 'multiple' => true, ]) ->add('enabled', CheckboxType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.enabled', + 'label' => 'sylius_cms.ui.enabled', ]) ->add('channels', ChannelChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.channels', + 'label' => 'sylius_cms.ui.channels', 'required' => false, 'multiple' => true, 'expanded' => true, ]) - ->add('locales') ->add('contentElements', CollectionType::class, [ 'label' => false, 'entry_type' => ContentConfigurationType::class, @@ -56,31 +68,47 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'allow_delete' => true, 'by_reference' => false, 'required' => false, + 'entry_options' => [ + 'label' => false, + ], + 'attr' => [ + 'class' => 'content-elements-container', + ], ]) ->add('products', ProductAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.display_for_products.label', + 'label' => 'sylius_cms.ui.display_for_products.label', 'multiple' => true, - 'help' => 'bitbag_sylius_cms_plugin.ui.display_for_products.help', + 'help' => 'sylius_cms.ui.display_for_products.help', ]) ->add('productsInTaxons', TaxonAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.display_for_products_in_taxons.label', + 'label' => 'sylius_cms.ui.display_for_products_in_taxons.label', 'multiple' => true, - 'help' => 'bitbag_sylius_cms_plugin.ui.display_for_products_in_taxons.help', + 'help' => 'sylius_cms.ui.display_for_products_in_taxons.help', ]) ->add('taxons', TaxonAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.display_for_taxons.label', + 'label' => 'sylius_cms.ui.display_for_taxons.label', 'multiple' => true, - 'help' => 'bitbag_sylius_cms_plugin.ui.display_for_taxons.help', + 'help' => 'sylius_cms.ui.display_for_taxons.help', ]) ->add('template', TemplateBlockAutocompleteChoiceType::class, [ 'label' => false, 'mapped' => false, ]) + ->add('locale', ChoiceType::class, [ + 'choices' => $this->locales, + 'mapped' => false, + 'label' => 'sylius.ui.locale', + 'attr' => [ + 'class' => 'locale-selector', + ], + ]) ; + + PageType::addContentElementLocaleListener($builder); } public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_block'; + return 'sylius_cms_block'; } } diff --git a/src/Form/Type/CollectionAutocompleteChoiceType.php b/src/Form/Type/CollectionAutocompleteChoiceType.php index 1ac306653..6d13254e9 100755 --- a/src/Form/Type/CollectionAutocompleteChoiceType.php +++ b/src/Form/Type/CollectionAutocompleteChoiceType.php @@ -1,14 +1,8 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.collection', + 'resource' => 'sylius_cms.collection', 'choice_name' => 'name', 'choice_value' => 'code', ]); @@ -38,7 +32,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_collection_autocomplete_choice'; + return 'sylius_collection_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/CollectionType.php b/src/Form/Type/CollectionType.php index 6478f89da..1a806737b 100755 --- a/src/Form/Type/CollectionType.php +++ b/src/Form/Type/CollectionType.php @@ -1,14 +1,8 @@ add('code', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.code', + 'label' => 'sylius_cms.ui.code', 'disabled' => null !== $builder->getData()->getCode(), ]) ->add('name', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.name', + 'label' => 'sylius_cms.ui.name', ]) ->add('type', ChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.type', + 'label' => 'sylius_cms.ui.type', 'choices' => [ - 'bitbag_sylius_cms_plugin.ui.page' => self::PAGE, - 'bitbag_sylius_cms_plugin.ui.block' => self::BLOCK, - 'bitbag_sylius_cms_plugin.ui.media' => self::MEDIA, + 'sylius_cms.ui.page' => self::PAGE, + 'sylius_cms.ui.block' => self::BLOCK, + 'sylius_cms.ui.media' => self::MEDIA, ], ]) ->add('pages', PageAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.pages', + 'label' => 'sylius_cms.ui.pages', 'multiple' => true, ]) ->add('blocks', BlockAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.blocks', + 'label' => 'sylius_cms.ui.blocks', 'multiple' => true, ]) ->add('media', MediaAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.media', + 'label' => 'sylius_cms.ui.media', 'multiple' => true, ]) ->addEventListener(FormEvents::PRE_SUBMIT, function (PreSubmitEvent $event): void { @@ -78,6 +72,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_collection'; + return 'sylius_cms_collection'; } } diff --git a/src/Form/Type/ContentConfigurationType.php b/src/Form/Type/ContentConfigurationType.php index ead59d4e8..f6572e438 100644 --- a/src/Form/Type/ContentConfigurationType.php +++ b/src/Form/Type/ContentConfigurationType.php @@ -1,18 +1,13 @@ $formType) { $this->actionConfigurationTypes[$type] = $formType::class; - $this->actionTypes['bitbag_sylius_cms_plugin.ui.content_elements.type.' . $type] = $type; + $this->actionTypes['sylius_cms.ui.content_elements.type.' . $type] = $type; } } @@ -44,13 +39,14 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $defaultActionConfigurationType = $this->actionConfigurationTypes[$defaultActionType]; $builder + ->add('locale', HiddenType::class) ->add('type', ChoiceType::class, [ 'label' => 'sylius.ui.type', 'choices' => $this->actionTypes, 'choice_attr' => function (?string $type) use ($builder): array { return [ 'data-configuration' => $this->twig->render( - '@BitBagSyliusCmsPlugin/ContentConfiguration/_action.html.twig', + '@SyliusCmsPlugin/ContentConfiguration/_action.html.twig', [ 'field' => $builder->create( 'configuration', @@ -112,6 +108,6 @@ private function addConfigurationTypeToForm(FormEvent $event): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_configuration'; + return 'sylius_cms_content_configuration'; } } diff --git a/src/Form/Type/ContentElementType.php b/src/Form/Type/ContentElementType.php index 1be324c93..4d3091c56 100644 --- a/src/Form/Type/ContentElementType.php +++ b/src/Form/Type/ContentElementType.php @@ -1,14 +1,8 @@ contentElementTypes as $type => $formType) { - $this->contentElements['bitbag_sylius_cms_plugin.ui.content_elements.type.' . $type] = $type; + $this->contentElements['sylius_cms.ui.content_elements.type.' . $type] = $type; } } @@ -30,7 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('type', ChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.type', + 'label' => 'sylius_cms.ui.type', 'choices' => $this->contentElements, ]) ; diff --git a/src/Form/Type/ContentElements/HeadingContentElementType.php b/src/Form/Type/ContentElements/HeadingContentElementType.php index 49d2ef3f5..2eea9757f 100644 --- a/src/Form/Type/ContentElements/HeadingContentElementType.php +++ b/src/Form/Type/ContentElements/HeadingContentElementType.php @@ -1,14 +1,8 @@ add('heading_type', ChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.heading_type', + 'label' => 'sylius_cms.ui.content_elements.heading_type', 'choices' => [ 'H1' => 'h1', 'H2' => 'h2', @@ -36,13 +30,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'empty_data' => 'h1', ]) ->add(self::TYPE, TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE, + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, ]) ; } public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/MultipleMediaContentElementType.php b/src/Form/Type/ContentElements/MultipleMediaContentElementType.php index 4406258f6..0d5fcec9c 100644 --- a/src/Form/Type/ContentElements/MultipleMediaContentElementType.php +++ b/src/Form/Type/ContentElements/MultipleMediaContentElementType.php @@ -1,16 +1,10 @@ add(self::TYPE, MediaAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE, + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, 'multiple' => true, ]) ; @@ -37,6 +31,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/PagesCollectionContentElementType.php b/src/Form/Type/ContentElements/PagesCollectionContentElementType.php index a2ffc366f..410bb3ec3 100644 --- a/src/Form/Type/ContentElements/PagesCollectionContentElementType.php +++ b/src/Form/Type/ContentElements/PagesCollectionContentElementType.php @@ -1,18 +1,12 @@ add(self::TYPE, PageCollectionAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE, + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, ]) ; @@ -45,6 +39,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/ProductsCarouselByTaxonContentElementType.php b/src/Form/Type/ContentElements/ProductsCarouselByTaxonContentElementType.php index d39aa28fa..b3ff0b0c8 100644 --- a/src/Form/Type/ContentElements/ProductsCarouselByTaxonContentElementType.php +++ b/src/Form/Type/ContentElements/ProductsCarouselByTaxonContentElementType.php @@ -1,18 +1,12 @@ add(self::TYPE, TaxonAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.taxon', + 'label' => 'sylius_cms.ui.taxon', 'choice_value' => 'code', 'resource' => 'sylius.taxon', ]) @@ -47,6 +41,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/ProductsCarouselContentElementType.php b/src/Form/Type/ContentElements/ProductsCarouselContentElementType.php index 990c54c95..e8ab722f1 100644 --- a/src/Form/Type/ContentElements/ProductsCarouselContentElementType.php +++ b/src/Form/Type/ContentElements/ProductsCarouselContentElementType.php @@ -1,14 +1,8 @@ add(self::TYPE, TaxonAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.taxon', + 'label' => 'sylius_cms.ui.taxon', 'choice_value' => 'code', 'resource' => 'sylius.taxon', ]) @@ -47,6 +41,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/ProductsGridContentElementType.php b/src/Form/Type/ContentElements/ProductsGridContentElementType.php index a46743372..bcf15f037 100644 --- a/src/Form/Type/ContentElements/ProductsGridContentElementType.php +++ b/src/Form/Type/ContentElements/ProductsGridContentElementType.php @@ -1,14 +1,8 @@ add(self::TYPE, MediaAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE, + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, ]) ; @@ -45,6 +39,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/SpacerContentElementType.php b/src/Form/Type/ContentElements/SpacerContentElementType.php index adb0a5d19..ca2d45e34 100644 --- a/src/Form/Type/ContentElements/SpacerContentElementType.php +++ b/src/Form/Type/ContentElements/SpacerContentElementType.php @@ -1,14 +1,8 @@ add(self::TYPE, NumberType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE . '_height', + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE . '_height', 'attr' => [ 'min' => 0, ], @@ -33,6 +27,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ContentElements/TaxonsListContentElementType.php b/src/Form/Type/ContentElements/TaxonsListContentElementType.php index d3da4df7f..3ac14c567 100644 --- a/src/Form/Type/ContentElements/TaxonsListContentElementType.php +++ b/src/Form/Type/ContentElements/TaxonsListContentElementType.php @@ -1,14 +1,8 @@ add(self::TYPE, WysiwygType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.content_elements.type.' . self::TYPE, + 'label' => 'sylius_cms.ui.content_elements.type.' . self::TYPE, ]) ; } public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_content_elements_' . self::TYPE; + return 'sylius_cms_content_elements_' . self::TYPE; } } diff --git a/src/Form/Type/ImportType.php b/src/Form/Type/ImportType.php index 0c5651259..f1d4b2916 100644 --- a/src/Form/Type/ImportType.php +++ b/src/Form/Type/ImportType.php @@ -1,14 +1,8 @@ true, 'constraints' => [ new NotNull([ - 'message' => 'bitbag_sylius_cms_plugin.import.not_blank', + 'message' => 'sylius_cms.import.not_blank', ]), new File([ 'mimeTypes' => ['text/csv', 'text/plain'], - 'mimeTypesMessage' => 'bitbag_sylius_cms_plugin.import.invalid_format', + 'mimeTypesMessage' => 'sylius_cms.import.invalid_format', ]), ], ]); diff --git a/src/Form/Type/MediaAutocompleteChoiceType.php b/src/Form/Type/MediaAutocompleteChoiceType.php index 397cd5902..045511602 100644 --- a/src/Form/Type/MediaAutocompleteChoiceType.php +++ b/src/Form/Type/MediaAutocompleteChoiceType.php @@ -1,17 +1,11 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.media', + 'resource' => 'sylius_cms.media', 'choice_name' => 'name', 'choice_value' => 'code', 'media_type' => [ @@ -45,7 +39,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_media_autocomplete_choice'; + return 'sylius_media_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/MediaImageAutocompleteChoiceType.php b/src/Form/Type/MediaImageAutocompleteChoiceType.php index badf0cb17..2b7e67822 100644 --- a/src/Form/Type/MediaImageAutocompleteChoiceType.php +++ b/src/Form/Type/MediaImageAutocompleteChoiceType.php @@ -1,17 +1,11 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.media', + 'resource' => 'sylius_cms.media', 'choice_name' => 'name', 'choice_value' => 'code', 'media_type' => [MediaInterface::IMAGE_TYPE], @@ -41,7 +35,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_media_autocomplete_choice'; + return 'sylius_media_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/MediaType.php b/src/Form/Type/MediaType.php index 4672b2dd9..4cdc7a749 100644 --- a/src/Form/Type/MediaType.php +++ b/src/Form/Type/MediaType.php @@ -1,19 +1,13 @@ add('code', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.code', + 'label' => 'sylius_cms.ui.code', 'disabled' => null !== $data && null !== $data->getCode(), ]) ->add('name', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.name', + 'label' => 'sylius_cms.ui.name', ]) ->add('type', ChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.type', + 'label' => 'sylius_cms.ui.type', 'choices' => $this->providers, ]) ->add('file', FileType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.file', + 'label' => 'sylius_cms.ui.file', ]) ->add('collections', CollectionAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.collections', + 'label' => 'sylius_cms.ui.collections', 'multiple' => true, ]) ->add('enabled', CheckboxType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.enabled', + 'label' => 'sylius_cms.ui.enabled', ]) ->add('saveWithOriginalName', CheckboxType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.save_with_original_name', + 'label' => 'sylius_cms.ui.save_with_original_name', ]) ->add('channels', ChannelChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.channels', + 'label' => 'sylius_cms.ui.channels', 'required' => false, 'multiple' => true, 'expanded' => true, ]) ->add('path', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.path', + 'label' => 'sylius_cms.ui.path', 'disabled' => true, 'required' => false, ]) @@ -83,6 +76,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_media'; + return 'sylius_cms_media'; } } diff --git a/src/Form/Type/PageAutocompleteChoiceType.php b/src/Form/Type/PageAutocompleteChoiceType.php index b1fd7639b..86c27d7be 100644 --- a/src/Form/Type/PageAutocompleteChoiceType.php +++ b/src/Form/Type/PageAutocompleteChoiceType.php @@ -1,14 +1,8 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.page', + 'resource' => 'sylius_cms.page', 'choice_name' => 'name', 'choice_value' => 'code', ]); @@ -38,7 +32,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_page_autocomplete_choice'; + return 'sylius_page_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/PageCollectionAutocompleteChoiceType.php b/src/Form/Type/PageCollectionAutocompleteChoiceType.php index cb985025d..7f543b0ec 100755 --- a/src/Form/Type/PageCollectionAutocompleteChoiceType.php +++ b/src/Form/Type/PageCollectionAutocompleteChoiceType.php @@ -1,14 +1,8 @@ setDefaults([ - 'resource' => 'bitbag_sylius_cms_plugin.collection', + 'resource' => 'sylius_cms.collection', 'choice_name' => 'name', 'choice_value' => 'code', ]); @@ -38,7 +32,7 @@ public function buildView( public function getBlockPrefix(): string { - return 'bitbag_page_collection_autocomplete_choice'; + return 'sylius_page_collection_autocomplete_choice'; } public function getParent(): string diff --git a/src/Form/Type/PageType.php b/src/Form/Type/PageType.php index 9834f9256..6b02ddb78 100755 --- a/src/Form/Type/PageType.php +++ b/src/Form/Type/PageType.php @@ -1,57 +1,72 @@ localeRepository->findAll(); + foreach ($locales as $locale) { + $this->locales[$locale->getName()] = $locale->getCode(); + } + } + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('code', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.code', + 'label' => 'sylius_cms.ui.code', 'disabled' => null !== $builder->getData()->getCode(), ]) ->add('name', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.name', + 'label' => 'sylius_cms.ui.name', ]) ->add('enabled', CheckboxType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.enabled', + 'label' => 'sylius_cms.ui.enabled', ]) ->add('translations', ResourceTranslationsType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.images', + 'label' => 'sylius_cms.ui.images', 'entry_type' => PageTranslationType::class, ]) ->add('collections', CollectionAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.collections', + 'label' => 'sylius_cms.ui.collections', 'multiple' => true, ]) ->add('channels', ChannelChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.channels', + 'label' => 'sylius_cms.ui.channels', 'required' => false, 'multiple' => true, 'expanded' => true, ]) ->add('publishAt', DateTimeType::class, [ 'input' => 'datetime_immutable', - 'label' => 'bitbag_sylius_cms_plugin.ui.publish_at', + 'label' => 'sylius_cms.ui.publish_at', 'date_widget' => 'single_text', 'time_widget' => 'single_text', 'required' => false, @@ -63,28 +78,50 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'allow_delete' => true, 'by_reference' => false, 'required' => false, + 'entry_options' => [ + 'label' => false, + ], + 'attr' => [ + 'class' => 'content-elements-container', + ], ]) ->add('template', TemplatePageAutocompleteChoiceType::class, [ 'label' => false, 'mapped' => false, ]) - ->add('teaserTitle', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.teaser.title', - 'required' => false, - ]) - ->add('teaserContent', WysiwygType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.teaser.content', - 'required' => false, - ]) - ->add('teaserImage', MediaImageAutocompleteChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.teaser.image', - 'required' => false, + ->add('locale', ChoiceType::class, [ + 'choices' => $this->locales, + 'mapped' => false, + 'label' => 'sylius.ui.locale', + 'attr' => [ + 'class' => 'locale-selector', + ], ]) ; + + self::addContentElementLocaleListener($builder); + } + + public static function addContentElementLocaleListener(FormBuilderInterface $builder): void + { + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { + $data = $event->getData(); + $selectedLocale = $data['locale'] ?? null; + + if (isset($data['contentElements'])) { + foreach ($data['contentElements'] as &$contentElement) { + if (empty($contentElement['locale'])) { + $contentElement['locale'] = $selectedLocale; + } + } + } + + $event->setData($data); + }); } public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_page'; + return 'sylius_cms_page'; } } diff --git a/src/Form/Type/TemplateBlockAutocompleteChoiceType.php b/src/Form/Type/TemplateBlockAutocompleteChoiceType.php index c07373193..121bf2346 100644 --- a/src/Form/Type/TemplateBlockAutocompleteChoiceType.php +++ b/src/Form/Type/TemplateBlockAutocompleteChoiceType.php @@ -1,19 +1,13 @@ add('name', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.name', + 'label' => 'sylius_cms.ui.name', ]) ->add('type', ChoiceType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.type', + 'label' => 'sylius_cms.ui.type', 'choices' => [ - 'bitbag_sylius_cms_plugin.ui.page' => 'page', - 'bitbag_sylius_cms_plugin.ui.block' => 'block', + 'sylius_cms.ui.page' => 'page', + 'sylius_cms.ui.block' => 'block', ], ]) ->add('contentElements', CollectionType::class, [ @@ -44,6 +38,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_template'; + return 'sylius_cms_template'; } } diff --git a/src/Form/Type/Translation/MediaTranslationType.php b/src/Form/Type/Translation/MediaTranslationType.php index 5df403306..1dc707d04 100755 --- a/src/Form/Type/Translation/MediaTranslationType.php +++ b/src/Form/Type/Translation/MediaTranslationType.php @@ -1,17 +1,11 @@ add('alt', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.alt', + 'label' => 'sylius_cms.ui.alt', 'required' => false, ]) ->add('link', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.link', + 'label' => 'sylius_cms.ui.link', 'required' => false, ]) ->add('content', WysiwygType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.link_content', + 'label' => 'sylius_cms.ui.link_content', 'required' => false, ]) ; @@ -37,6 +31,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_media_translation'; + return 'sylius_cms_media_translation'; } } diff --git a/src/Form/Type/Translation/PageTranslationType.php b/src/Form/Type/Translation/PageTranslationType.php index e23c84e44..fbd264562 100755 --- a/src/Form/Type/Translation/PageTranslationType.php +++ b/src/Form/Type/Translation/PageTranslationType.php @@ -1,16 +1,12 @@ add('slug', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.slug', + 'label' => 'sylius_cms.ui.slug', ]) ->add('title', TextType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.meta_title', + 'label' => 'sylius_cms.ui.meta_title', 'required' => false, ]) ->add('metaKeywords', TextareaType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.meta_keywords', + 'label' => 'sylius_cms.ui.meta_keywords', 'required' => false, ]) ->add('metaDescription', TextareaType::class, [ - 'label' => 'bitbag_sylius_cms_plugin.ui.meta_description', + 'label' => 'sylius_cms.ui.meta_description', + 'required' => false, + ]) + ->add('teaserTitle', TextType::class, [ + 'label' => 'sylius_cms.ui.teaser.title', + 'required' => false, + ]) + ->add('teaserContent', WysiwygType::class, [ + 'label' => 'sylius_cms.ui.teaser.content', + 'required' => false, + ]) + ->add('teaserImage', MediaImageAutocompleteChoiceType::class, [ + 'label' => 'sylius_cms.ui.teaser.image', 'required' => false, ]) ; @@ -40,6 +48,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function getBlockPrefix(): string { - return 'bitbag_sylius_cms_plugin_page_translation'; + return 'sylius_cms_page_translation'; } } diff --git a/src/Form/Type/WysiwygType.php b/src/Form/Type/WysiwygType.php index 6318c3d0a..d11c662aa 100644 --- a/src/Form/Type/WysiwygType.php +++ b/src/Form/Type/WysiwygType.php @@ -1,14 +1,8 @@ setDefaults([ - 'label' => 'bitbag_sylius_cms_plugin.ui.content', + 'label' => 'sylius_cms.ui.content', 'config' => [ - 'filebrowserUploadUrl' => $this->urlGenerator->generate('bitbag_sylius_cms_plugin_admin_upload_editor_image'), - 'bodyId' => 'bitbag-ckeditor', + 'filebrowserUploadUrl' => $this->urlGenerator->generate('sylius_cms_admin_upload_editor_image'), + 'bodyId' => 'cms-ckeditor', ], ]); } @@ -39,6 +33,6 @@ public function getParent(): string public function getBlockPrefix(): string { - return 'bitbag_wysiwyg'; + return 'sylius_wysiwyg'; } } diff --git a/src/Importer/AbstractImporter.php b/src/Importer/AbstractImporter.php index 52147a013..e053006b8 100755 --- a/src/Importer/AbstractImporter.php +++ b/src/Importer/AbstractImporter.php @@ -1,14 +1,8 @@ importerCollectionsResolver->resolve($block, $this->getColumnValue(self::COLLECTIONS_COLUMN, $row)); $this->importerChannelsResolver->resolve($block, $this->getColumnValue(self::CHANNELS_COLUMN, $row)); - $this->importerLocalesResolver->resolve($block, $this->getColumnValue(self::LOCALES_COLUMN, $row)); $this->importerProductsResolver->resolve($block, $this->getColumnValue(self::PRODUCTS_COLUMN, $row)); $this->importerTaxonsResolver->resolve($block, $this->getColumnValue(self::TAXONS_COLUMN, $row)); $this->importerProductsInTaxonsResolver->resolve($block, $this->getColumnValue(self::PRODUCTS_IN_TAXONS_COLUMN, $row)); - $this->validateResource($block, ['bitbag']); + $this->validateResource($block, ['cms']); $this->blockRepository->add($block); } diff --git a/src/Importer/BlockImporterInterface.php b/src/Importer/BlockImporterInterface.php index fce4522af..a22b25457 100644 --- a/src/Importer/BlockImporterInterface.php +++ b/src/Importer/BlockImporterInterface.php @@ -1,14 +1,8 @@ getColumnValue(self::CODE_COLUMN, $row); + Assert::notNull($code); + /** @var BlockInterface $block */ + $block = $this->blockResourceResolver->getResource($code); + $block->setCode($code); + + $this->importerCollectionsResolver->resolve($block, $this->getColumnValue(self::SECTIONS_COLUMN, $row)); + $this->importerChannelsResolver->resolve($block, $this->getColumnValue(self::CHANNELS_COLUMN, $row)); + + $translationArray = $this->getAvailableLocales($this->getTranslatableColumns(), array_keys($row)); + foreach ($translationArray as $key => $locale) { + if ($key === array_key_first($translationArray)) { + $block->setName($this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row)); + } + + $heading = ContentElementFactory::createHeadingContentElement( + $locale, + 'h2', + $this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row), + ); + if ($heading) { + $heading->setBlock($block); + $block->addContentElement($heading); + } + + $singleMedia = ContentElementFactory::createSingleMediaContentElement( + $locale, + $this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row), + ); + if ($singleMedia) { + $singleMedia->setBlock($block); + $block->addContentElement($singleMedia); + } + + $content = ContentElementFactory::createTextareaContentElement( + $locale, + $this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row), + ); + if ($content) { + $content->setBlock($block); + $block->addContentElement($content); + } + } + + $locales = $this->localeRepository->findAll(); + /** @var LocaleInterface $locale */ + foreach ($locales as $locale) { + $productsGrid = ContentElementFactory::createProductsGridContentElement( + $locale->getCode(), + $this->getColumnValue(self::PRODUCTS_COLUMN, $row), + ); + if ($productsGrid) { + $productsGrid->setBlock($block); + $block->addContentElement($productsGrid); + } + } + + $this->validateResource($block, ['cms']); + $this->blockRepository->add($block); + } + + public function getResourceCode(): string + { + return 'block_legacy'; + } + + private function getTranslatableColumns(): array + { + return [ + self::NAME_COLUMN, + self::CONTENT_COLUMN, + self::IMAGE_COLUMN, + ]; + } +} diff --git a/src/Importer/Legacy/LegacyBlockImporterInterface.php b/src/Importer/Legacy/LegacyBlockImporterInterface.php new file mode 100644 index 000000000..182699840 --- /dev/null +++ b/src/Importer/Legacy/LegacyBlockImporterInterface.php @@ -0,0 +1,24 @@ +getColumnValue(self::CODE_COLUMN, $row); + Assert::notNull($code); + + /** @var PageInterface $page */ + $page = $this->pageResourceResolver->getResource($code); + + $page->setCode($code); + $page->setFallbackLocale($this->localeContext->getLocaleCode()); + + $this->importerCollectionsResolver->resolve($page, $this->getColumnValue(self::SECTIONS_COLUMN, $row)); + $this->importerChannelsResolver->resolve($page, $this->getColumnValue(self::CHANNELS_COLUMN, $row)); + + $translationArray = $this->getAvailableLocales($this->getTranslatableColumns(), array_keys($row)); + foreach ($translationArray as $key => $locale) { + $page->setCurrentLocale($locale); + $page->setSlug($this->getTranslatableColumnValue(self::SLUG_COLUMN, $locale, $row)); + $page->setMetaKeywords($this->getTranslatableColumnValue(self::META_KEYWORDS_COLUMN, $locale, $row)); + $page->setMetaDescription($this->getTranslatableColumnValue(self::META_DESCRIPTION_COLUMN, $locale, $row)); + + if ($key === array_key_first($translationArray)) { + $page->setName($this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row)); + } + + $page->setTeaserTitle($this->getTranslatableColumnValue(self::NAME_WHEN_LINKED_COLUMN, $locale, $row)); + $page->setTeaserContent($this->getTranslatableColumnValue(self::DESCRIPTION_WHEN_LINKED_COLUMN, $locale, $row)); + + $heading = ContentElementFactory::createHeadingContentElement( + $locale, + 'h2', + $this->getTranslatableColumnValue(self::NAME_COLUMN, $locale, $row), + ); + if ($heading) { + $heading->setPage($page); + $page->addContentElement($heading); + } + + $singleMedia = ContentElementFactory::createSingleMediaContentElement( + $locale, + $this->getTranslatableColumnValue(self::IMAGE_COLUMN, $locale, $row), + ); + if ($singleMedia) { + $singleMedia->setPage($page); + $page->addContentElement($singleMedia); + } + + $content = ContentElementFactory::createTextareaContentElement( + $locale, + $this->getTranslatableColumnValue(self::CONTENT_COLUMN, $locale, $row), + ); + if ($content) { + $content->setPage($page); + $page->addContentElement($content); + } + } + + $locales = $this->localeRepository->findAll(); + /** @var LocaleInterface $locale */ + foreach ($locales as $locale) { + $productsGrid = ContentElementFactory::createProductsGridContentElement( + $locale->getCode(), + $this->getColumnValue(self::PRODUCTS_COLUMN, $row), + ); + if ($productsGrid) { + $productsGrid->setPage($page); + $page->addContentElement($productsGrid); + } + } + + $this->validateResource($page, ['cms']); + + $this->entityManager->persist($page); + $this->entityManager->flush(); + } + + public function getResourceCode(): string + { + return 'page_legacy'; + } + + private function getTranslatableColumns(): array + { + return [ + self::SLUG_COLUMN, + self::NAME_COLUMN, + self::IMAGE_COLUMN, + self::CONTENT_COLUMN, + self::META_KEYWORDS_COLUMN, + self::META_DESCRIPTION_COLUMN, + self::NAME_WHEN_LINKED_COLUMN, + self::DESCRIPTION_WHEN_LINKED_COLUMN, + ]; + } +} diff --git a/src/Importer/Legacy/LegacyPageImporterInterface.php b/src/Importer/Legacy/LegacyPageImporterInterface.php new file mode 100644 index 000000000..bc6e980f4 --- /dev/null +++ b/src/Importer/Legacy/LegacyPageImporterInterface.php @@ -0,0 +1,34 @@ +importerCollectionsResolver->resolve($media, $this->getColumnValue(self::COLLECTIONS_COLUMN, $row)); - $this->validateResource($media, ['bitbag']); + $this->validateResource($media, ['cms']); $this->mediaRepository->add($media); } diff --git a/src/Importer/MediaImporterInterface.php b/src/Importer/MediaImporterInterface.php index 2d20980f5..79872ea4f 100644 --- a/src/Importer/MediaImporterInterface.php +++ b/src/Importer/MediaImporterInterface.php @@ -1,14 +1,8 @@ importerCollectionsResolver->resolve($page, $this->getColumnValue(self::COLLECTIONS_COLUMN, $row)); $this->importerChannelsResolver->resolve($page, $this->getColumnValue(self::CHANNELS_COLUMN, $row)); - $this->validateResource($page, ['bitbag']); + $this->validateResource($page, ['cms']); $this->entityManager->persist($page); $this->entityManager->flush(); diff --git a/src/Importer/PageImporterInterface.php b/src/Importer/PageImporterInterface.php index ec3da1320..ae6eaa795 100644 --- a/src/Importer/PageImporterInterface.php +++ b/src/Importer/PageImporterInterface.php @@ -1,14 +1,8 @@ getMenu(); $cmsRootMenuItem = $menu - ->addChild('bitbag_cms') - ->setLabel('bitbag_sylius_cms_plugin.ui.cms') + ->addChild('sylius_cms') + ->setLabel('sylius_cms.ui.cms') ; $cmsRootMenuItem ->addChild('collections', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_collection_index', + 'route' => 'sylius_cms_admin_collection_index', ]) - ->setLabel('bitbag_sylius_cms_plugin.ui.collections') + ->setLabel('sylius_cms.ui.collections') ->setLabelAttribute('icon', 'grid layout') ; $cmsRootMenuItem ->addChild('templates', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_template_index', + 'route' => 'sylius_cms_admin_template_index', ]) - ->setLabel('bitbag_sylius_cms_plugin.ui.templates') + ->setLabel('sylius_cms.ui.templates') ->setLabelAttribute('icon', 'clone') ; $cmsRootMenuItem ->addChild('pages', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_page_index', + 'route' => 'sylius_cms_admin_page_index', ]) - ->setLabel('bitbag_sylius_cms_plugin.ui.pages') + ->setLabel('sylius_cms.ui.pages') ->setLabelAttribute('icon', 'sticky note') ; $cmsRootMenuItem ->addChild('blocks', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_block_index', + 'route' => 'sylius_cms_admin_block_index', ]) - ->setLabel('bitbag_sylius_cms_plugin.ui.blocks') + ->setLabel('sylius_cms.ui.blocks') ->setLabelAttribute('icon', 'block layout') ; $cmsRootMenuItem ->addChild('media', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_media_index', + 'route' => 'sylius_cms_admin_media_index', ]) - ->setLabel('bitbag_sylius_cms_plugin.ui.media') + ->setLabel('sylius_cms.ui.media') ->setLabelAttribute('icon', 'file') ; - $this->menuReorder->reorder($menu, 'bitbag_cms', 'marketing'); + $this->menuReorder->reorder($menu, 'sylius_cms', 'marketing'); } } diff --git a/src/Menu/MenuReorder.php b/src/Menu/MenuReorder.php index 283d37028..a57fa8c94 100644 --- a/src/Menu/MenuReorder.php +++ b/src/Menu/MenuReorder.php @@ -1,14 +1,8 @@ addSql('ALTER TABLE bitbag_cms_block_taxons DROP FOREIGN KEY FK_E324C6CEDE13F470'); + $this->addSql('ALTER TABLE bitbag_cms_block_taxons DROP FOREIGN KEY FK_E324C6CEE9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_faq_translation DROP FOREIGN KEY FK_8B30DD2E2C2AC5D3'); + $this->addSql('ALTER TABLE bitbag_cms_page_channels DROP FOREIGN KEY FK_DCA426972F5A1AA'); + $this->addSql('ALTER TABLE bitbag_cms_page_channels DROP FOREIGN KEY FK_DCA4269C4663E4'); + $this->addSql('ALTER TABLE bitbag_cms_block_channels DROP FOREIGN KEY FK_8417B07372F5A1AA'); + $this->addSql('ALTER TABLE bitbag_cms_block_channels DROP FOREIGN KEY FK_8417B073E9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_block_products_in_taxons DROP FOREIGN KEY FK_DAA9DD18E9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_block_products_in_taxons DROP FOREIGN KEY FK_DAA9DD18DE13F470'); + $this->addSql('ALTER TABLE bitbag_cms_media_products DROP FOREIGN KEY FK_91A7DAC24584665A'); + $this->addSql('ALTER TABLE bitbag_cms_media_products DROP FOREIGN KEY FK_91A7DAC2EA9FDD75'); + $this->addSql('ALTER TABLE bitbag_cms_section_pages DROP FOREIGN KEY FK_C96225EEC4663E4'); + $this->addSql('ALTER TABLE bitbag_cms_section_pages DROP FOREIGN KEY FK_C96225EED823E37A'); + $this->addSql('ALTER TABLE bitbag_cms_media_translation DROP FOREIGN KEY FK_1FEC58972C2AC5D3'); + $this->addSql('ALTER TABLE bitbag_cms_page_translation DROP FOREIGN KEY FK_FDD074A62C2AC5D3'); + $this->addSql('ALTER TABLE bitbag_cms_section_blocks DROP FOREIGN KEY FK_A9D9C974D823E37A'); + $this->addSql('ALTER TABLE bitbag_cms_section_blocks DROP FOREIGN KEY FK_A9D9C974E9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_block_products DROP FOREIGN KEY FK_C4B9089F4584665A'); + $this->addSql('ALTER TABLE bitbag_cms_block_products DROP FOREIGN KEY FK_C4B9089FE9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_page DROP FOREIGN KEY FK_18F07F1BF56F16CF'); + $this->addSql('ALTER TABLE bitbag_cms_block_locales DROP FOREIGN KEY FK_E1F907BAE559DFD1'); + $this->addSql('ALTER TABLE bitbag_cms_block_locales DROP FOREIGN KEY FK_E1F907BAE9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_section_media DROP FOREIGN KEY FK_833A6197D823E37A'); + $this->addSql('ALTER TABLE bitbag_cms_section_media DROP FOREIGN KEY FK_833A6197EA9FDD75'); + $this->addSql('ALTER TABLE bitbag_cms_content_configuration DROP FOREIGN KEY FK_D899EFA7E9ED820C'); + $this->addSql('ALTER TABLE bitbag_cms_content_configuration DROP FOREIGN KEY FK_D899EFA7C4663E4'); + $this->addSql('ALTER TABLE bitbag_cms_media_channels DROP FOREIGN KEY FK_D109622E72F5A1AA'); + $this->addSql('ALTER TABLE bitbag_cms_media_channels DROP FOREIGN KEY FK_D109622EEA9FDD75'); + $this->addSql('ALTER TABLE bitbag_cms_faq_channels DROP FOREIGN KEY FK_FF6D59AC72F5A1AA'); + $this->addSql('ALTER TABLE bitbag_cms_faq_channels DROP FOREIGN KEY FK_FF6D59AC81BEC8C2'); + + $this->addSql('RENAME TABLE bitbag_cms_template TO sylius_cms_template'); + $this->addSql('RENAME TABLE bitbag_cms_media TO sylius_cms_media'); + $this->addSql('RENAME TABLE bitbag_cms_block TO sylius_cms_block'); + $this->addSql('RENAME TABLE bitbag_cms_block_taxons TO sylius_cms_block_taxons'); + $this->addSql('RENAME TABLE bitbag_cms_page_channels TO sylius_cms_page_channels'); + $this->addSql('RENAME TABLE bitbag_cms_block_channels TO sylius_cms_block_channels'); + $this->addSql('RENAME TABLE bitbag_cms_block_products_in_taxons TO sylius_cms_block_products_in_taxons'); + $this->addSql('RENAME TABLE bitbag_cms_section_pages TO sylius_cms_section_pages'); + $this->addSql('RENAME TABLE bitbag_cms_media_translation TO sylius_cms_media_translation'); + $this->addSql('RENAME TABLE bitbag_cms_page_translation TO sylius_cms_page_translation'); + $this->addSql('RENAME TABLE bitbag_cms_section_blocks TO sylius_cms_section_blocks'); + $this->addSql('RENAME TABLE bitbag_cms_block_products TO sylius_cms_block_products'); + $this->addSql('RENAME TABLE bitbag_cms_page TO sylius_cms_page'); + $this->addSql('RENAME TABLE bitbag_cms_section TO sylius_cms_section'); + $this->addSql('RENAME TABLE bitbag_cms_block_locales TO sylius_cms_block_locales'); + $this->addSql('RENAME TABLE bitbag_cms_section_media TO sylius_cms_section_media'); + $this->addSql('RENAME TABLE bitbag_cms_content_configuration TO sylius_cms_content_configuration'); + $this->addSql('RENAME TABLE bitbag_cms_media_channels TO sylius_cms_media_channels'); + + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602FE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE559DFD1 FOREIGN KEY (locale_id) REFERENCES sylius_locale (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C3E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C34584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03DE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEDE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id)'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id)'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B272EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B27272F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_translation ADD CONSTRAINT FK_AAAC4A922C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page ADD CONSTRAINT FK_2C2740B2F56F16CF FOREIGN KEY (teaser_image_id) REFERENCES sylius_cms_media (id) ON DELETE SET NULL'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7FC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_translation ADD CONSTRAINT FK_6D0D401B2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8C4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + + $this->addSql('DROP TABLE bitbag_cms_faq_translation'); + $this->addSql('DROP TABLE bitbag_cms_media_products'); + $this->addSql('DROP TABLE bitbag_cms_faq'); + $this->addSql('DROP TABLE bitbag_cms_faq_channels'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602FE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602F72F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE559DFD1'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C3E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C34584665A'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03DE13F470'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEDE13F470'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DC4663E4'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B272EA9FDD75'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B27272F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_media_translation DROP FOREIGN KEY FK_AAAC4A922C2AC5D3'); + $this->addSql('ALTER TABLE sylius_cms_page DROP FOREIGN KEY FK_2C2740B2F56F16CF'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7FC4663E4'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7F72F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_page_translation DROP FOREIGN KEY FK_6D0D401B2C2AC5D3'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8C4663E4'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81EA9FDD75'); + + $this->addSql('RENAME TABLE sylius_cms_template TO bitbag_cms_template'); + $this->addSql('RENAME TABLE sylius_cms_media TO bitbag_cms_media'); + $this->addSql('RENAME TABLE sylius_cms_block TO bitbag_cms_block'); + $this->addSql('RENAME TABLE sylius_cms_block_taxons TO bitbag_cms_block_taxons'); + $this->addSql('RENAME TABLE sylius_cms_page_channels TO bitbag_cms_page_channels'); + $this->addSql('RENAME TABLE sylius_cms_block_channels TO bitbag_cms_block_channels'); + $this->addSql('RENAME TABLE sylius_cms_block_products_in_taxons TO bitbag_cms_block_products_in_taxons'); + $this->addSql('RENAME TABLE sylius_cms_section_pages TO bitbag_cms_section_pages'); + $this->addSql('RENAME TABLE sylius_cms_media_translation TO bitbag_cms_media_translation'); + $this->addSql('RENAME TABLE sylius_cms_page_translation TO bitbag_cms_page_translation'); + $this->addSql('RENAME TABLE sylius_cms_section_blocks TO bitbag_cms_section_blocks'); + $this->addSql('RENAME TABLE sylius_cms_block_products TO bitbag_cms_block_products'); + $this->addSql('RENAME TABLE sylius_cms_page TO bitbag_cms_page'); + $this->addSql('RENAME TABLE sylius_cms_section TO bitbag_cms_section'); + $this->addSql('RENAME TABLE sylius_cms_block_locales TO bitbag_cms_block_locales'); + $this->addSql('RENAME TABLE sylius_cms_section_media TO bitbag_cms_section_media'); + $this->addSql('RENAME TABLE sylius_cms_content_configuration TO bitbag_cms_content_configuration'); + $this->addSql('RENAME TABLE sylius_cms_media_channels TO bitbag_cms_media_channels'); + + $this->addSql('ALTER TABLE bitbag_cms_block_taxons ADD CONSTRAINT FK_E324C6CEDE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_taxons ADD CONSTRAINT FK_E324C6CEE9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_page_channels ADD CONSTRAINT FK_DCA426972F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_page_channels ADD CONSTRAINT FK_DCA4269C4663E4 FOREIGN KEY (page_id) REFERENCES bitbag_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_channels ADD CONSTRAINT FK_8417B07372F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_channels ADD CONSTRAINT FK_8417B073E9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_products_in_taxons ADD CONSTRAINT FK_DAA9DD18E9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_products_in_taxons ADD CONSTRAINT FK_DAA9DD18DE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_pages ADD CONSTRAINT FK_C96225EEC4663E4 FOREIGN KEY (page_id) REFERENCES bitbag_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_pages ADD CONSTRAINT FK_C96225EED823E37A FOREIGN KEY (section_id) REFERENCES bitbag_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_media_translation ADD CONSTRAINT FK_1FEC58972C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES bitbag_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_page_translation ADD CONSTRAINT FK_FDD074A62C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES bitbag_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_blocks ADD CONSTRAINT FK_A9D9C974D823E37A FOREIGN KEY (section_id) REFERENCES bitbag_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_blocks ADD CONSTRAINT FK_A9D9C974E9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_products ADD CONSTRAINT FK_C4B9089F4584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_products ADD CONSTRAINT FK_C4B9089FE9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_page ADD CONSTRAINT FK_18F07F1BF56F16CF FOREIGN KEY (teaser_image_id) REFERENCES bitbag_cms_media (id) ON DELETE SET NULL'); + $this->addSql('ALTER TABLE bitbag_cms_block_locales ADD CONSTRAINT FK_E1F907BAE559DFD1 FOREIGN KEY (locale_id) REFERENCES sylius_locale (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_block_locales ADD CONSTRAINT FK_E1F907BAE9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_media ADD CONSTRAINT FK_833A6197D823E37A FOREIGN KEY (section_id) REFERENCES bitbag_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_section_media ADD CONSTRAINT FK_833A6197EA9FDD75 FOREIGN KEY (media_id) REFERENCES bitbag_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_content_configuration ADD CONSTRAINT FK_D899EFA7E9ED820C FOREIGN KEY (block_id) REFERENCES bitbag_cms_block (id)'); + $this->addSql('ALTER TABLE bitbag_cms_content_configuration ADD CONSTRAINT FK_D899EFA7C4663E4 FOREIGN KEY (page_id) REFERENCES bitbag_cms_page (id)'); + $this->addSql('ALTER TABLE bitbag_cms_media_channels ADD CONSTRAINT FK_D109622E72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_media_channels ADD CONSTRAINT FK_D109622EEA9FDD75 FOREIGN KEY (media_id) REFERENCES bitbag_cms_media (id) ON DELETE CASCADE'); + + $this->addSql('CREATE TABLE bitbag_cms_faq_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT NOT NULL, question LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, answer LONGTEXT CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, locale VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, INDEX IDX_8B30DD2E2C2AC5D3 (translatable_id), UNIQUE INDEX bitbag_cms_faq_translation_uniq_trans (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('CREATE TABLE bitbag_cms_media_products (media_id INT NOT NULL, product_id INT NOT NULL, INDEX IDX_91A7DAC2EA9FDD75 (media_id), INDEX IDX_91A7DAC24584665A (product_id), PRIMARY KEY(media_id, product_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('CREATE TABLE bitbag_cms_faq (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, position INT NOT NULL, enabled TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('CREATE TABLE bitbag_cms_faq_channels (faq_id INT NOT NULL, channel_id INT NOT NULL, INDEX IDX_FF6D59AC81BEC8C2 (faq_id), INDEX IDX_FF6D59AC72F5A1AA (channel_id), PRIMARY KEY(faq_id, channel_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + + $this->addSql('ALTER TABLE bitbag_cms_faq_translation ADD CONSTRAINT FK_8B30DD2E2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES bitbag_cms_faq (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_media_products ADD CONSTRAINT FK_91A7DAC24584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_media_products ADD CONSTRAINT FK_91A7DAC2EA9FDD75 FOREIGN KEY (media_id) REFERENCES bitbag_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_faq_channels ADD CONSTRAINT FK_FF6D59AC72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE bitbag_cms_faq_channels ADD CONSTRAINT FK_FF6D59AC81BEC8C2 FOREIGN KEY (faq_id) REFERENCES bitbag_cms_faq (id) ON DELETE CASCADE'); + } +} diff --git a/src/Migrations/Version20240903103926.php b/src/Migrations/Version20240903103926.php new file mode 100644 index 000000000..5b466df32 --- /dev/null +++ b/src/Migrations/Version20240903103926.php @@ -0,0 +1,252 @@ +addSql('DROP INDEX uniq_321c84cf77153098 ON sylius_cms_block'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_9D2248BC77153098 ON sylius_cms_block (code)'); + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602F72F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602FE9ED820C'); + $this->addSql('DROP INDEX idx_8417b073e9ed820c ON sylius_cms_block_channels'); + $this->addSql('CREATE INDEX IDX_7026602FE9ED820C ON sylius_cms_block_channels (block_id)'); + $this->addSql('DROP INDEX idx_8417b07372f5a1aa ON sylius_cms_block_channels'); + $this->addSql('CREATE INDEX IDX_7026602F72F5A1AA ON sylius_cms_block_channels (channel_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602FE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE559DFD1'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE9ED820C'); + $this->addSql('DROP INDEX idx_e1f907bae9ed820c ON sylius_cms_block_locales'); + $this->addSql('CREATE INDEX IDX_49C0AACE9ED820C ON sylius_cms_block_locales (block_id)'); + $this->addSql('DROP INDEX idx_e1f907bae559dfd1 ON sylius_cms_block_locales'); + $this->addSql('CREATE INDEX IDX_49C0AACE559DFD1 ON sylius_cms_block_locales (locale_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE559DFD1 FOREIGN KEY (locale_id) REFERENCES sylius_locale (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C3E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C34584665A'); + $this->addSql('DROP INDEX idx_c4b9089fe9ed820c ON sylius_cms_block_products'); + $this->addSql('CREATE INDEX IDX_3088D8C3E9ED820C ON sylius_cms_block_products (block_id)'); + $this->addSql('DROP INDEX idx_c4b9089f4584665a ON sylius_cms_block_products'); + $this->addSql('CREATE INDEX IDX_3088D8C34584665A ON sylius_cms_block_products (product_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C3E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C34584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03DE13F470'); + $this->addSql('DROP INDEX idx_e324c6cee9ed820c ON sylius_cms_block_taxons'); + $this->addSql('CREATE INDEX IDX_5397DD03E9ED820C ON sylius_cms_block_taxons (block_id)'); + $this->addSql('DROP INDEX idx_e324c6cede13f470 ON sylius_cms_block_taxons'); + $this->addSql('CREATE INDEX IDX_5397DD03DE13F470 ON sylius_cms_block_taxons (taxon_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03DE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEDE13F470'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEE9ED820C'); + $this->addSql('DROP INDEX idx_daa9dd18e9ed820c ON sylius_cms_block_products_in_taxons'); + $this->addSql('CREATE INDEX IDX_B4D0B7CEE9ED820C ON sylius_cms_block_products_in_taxons (block_id)'); + $this->addSql('DROP INDEX idx_daa9dd18de13f470 ON sylius_cms_block_products_in_taxons'); + $this->addSql('CREATE INDEX IDX_B4D0B7CEDE13F470 ON sylius_cms_block_products_in_taxons (taxon_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEDE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DC4663E4'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DE9ED820C'); + $this->addSql('DROP INDEX idx_d899efa7e9ed820c ON sylius_cms_content_configuration'); + $this->addSql('CREATE INDEX IDX_BB97608DE9ED820C ON sylius_cms_content_configuration (block_id)'); + $this->addSql('DROP INDEX idx_d899efa7c4663e4 ON sylius_cms_content_configuration'); + $this->addSql('CREATE INDEX IDX_BB97608DC4663E4 ON sylius_cms_content_configuration (page_id)'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id)'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id)'); + $this->addSql('DROP INDEX uniq_db2bb2e177153098 ON sylius_cms_media'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_74157E9277153098 ON sylius_cms_media (code)'); + $this->addSql('DROP INDEX uniq_db2bb2e1b548b0f ON sylius_cms_media'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_74157E92B548B0F ON sylius_cms_media (path)'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B27272F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B272EA9FDD75'); + $this->addSql('DROP INDEX idx_d109622eea9fdd75 ON sylius_cms_media_channels'); + $this->addSql('CREATE INDEX IDX_2538B272EA9FDD75 ON sylius_cms_media_channels (media_id)'); + $this->addSql('DROP INDEX idx_d109622e72f5a1aa ON sylius_cms_media_channels'); + $this->addSql('CREATE INDEX IDX_2538B27272F5A1AA ON sylius_cms_media_channels (channel_id)'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B27272F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B272EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_translation DROP FOREIGN KEY FK_AAAC4A922C2AC5D3'); + $this->addSql('DROP INDEX idx_1fec58972c2ac5d3 ON sylius_cms_media_translation'); + $this->addSql('CREATE INDEX IDX_AAAC4A922C2AC5D3 ON sylius_cms_media_translation (translatable_id)'); + $this->addSql('DROP INDEX bitbag_cms_media_translation_uniq_trans ON sylius_cms_media_translation'); + $this->addSql('CREATE UNIQUE INDEX sylius_cms_media_translation_uniq_trans ON sylius_cms_media_translation (translatable_id, locale)'); + $this->addSql('ALTER TABLE sylius_cms_media_translation ADD CONSTRAINT FK_AAAC4A922C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page DROP FOREIGN KEY FK_2C2740B2F56F16CF'); + $this->addSql('DROP INDEX uniq_18f07f1b77153098 ON sylius_cms_page'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_2C2740B277153098 ON sylius_cms_page (code)'); + $this->addSql('DROP INDEX idx_18f07f1bf56f16cf ON sylius_cms_page'); + $this->addSql('CREATE INDEX IDX_2C2740B2F56F16CF ON sylius_cms_page (teaser_image_id)'); + $this->addSql('ALTER TABLE sylius_cms_page ADD CONSTRAINT FK_2C2740B2F56F16CF FOREIGN KEY (teaser_image_id) REFERENCES sylius_cms_media (id) ON DELETE SET NULL'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7F72F5A1AA'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7FC4663E4'); + $this->addSql('DROP INDEX idx_dca4269c4663e4 ON sylius_cms_page_channels'); + $this->addSql('CREATE INDEX IDX_E8AF4F7FC4663E4 ON sylius_cms_page_channels (page_id)'); + $this->addSql('DROP INDEX idx_dca426972f5a1aa ON sylius_cms_page_channels'); + $this->addSql('CREATE INDEX IDX_E8AF4F7F72F5A1AA ON sylius_cms_page_channels (channel_id)'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7FC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_translation DROP FOREIGN KEY FK_6D0D401B2C2AC5D3'); + $this->addSql('DROP INDEX idx_fdd074a62c2ac5d3 ON sylius_cms_page_translation'); + $this->addSql('CREATE INDEX IDX_6D0D401B2C2AC5D3 ON sylius_cms_page_translation (translatable_id)'); + $this->addSql('DROP INDEX bitbag_cms_page_translation_uniq_trans ON sylius_cms_page_translation'); + $this->addSql('CREATE UNIQUE INDEX sylius_cms_page_translation_uniq_trans ON sylius_cms_page_translation (translatable_id, locale)'); + $this->addSql('ALTER TABLE sylius_cms_page_translation ADD CONSTRAINT FK_6D0D401B2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('DROP INDEX uniq_421d079777153098 ON sylius_cms_section'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_D4DD0C0777153098 ON sylius_cms_section (code)'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8C4663E4'); + $this->addSql('DROP INDEX idx_c96225eed823e37a ON sylius_cms_section_pages'); + $this->addSql('CREATE INDEX IDX_2C0728F8D823E37A ON sylius_cms_section_pages (section_id)'); + $this->addSql('DROP INDEX idx_c96225eec4663e4 ON sylius_cms_section_pages'); + $this->addSql('CREATE INDEX IDX_2C0728F8C4663E4 ON sylius_cms_section_pages (page_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8C4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928E9ED820C'); + $this->addSql('DROP INDEX idx_a9d9c974d823e37a ON sylius_cms_section_blocks'); + $this->addSql('CREATE INDEX IDX_5DE81928D823E37A ON sylius_cms_section_blocks (section_id)'); + $this->addSql('DROP INDEX idx_a9d9c974e9ed820c ON sylius_cms_section_blocks'); + $this->addSql('CREATE INDEX IDX_5DE81928E9ED820C ON sylius_cms_section_blocks (block_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81EA9FDD75'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81D823E37A'); + $this->addSql('DROP INDEX idx_833a6197d823e37a ON sylius_cms_section_media'); + $this->addSql('CREATE INDEX IDX_665F6C81D823E37A ON sylius_cms_section_media (section_id)'); + $this->addSql('DROP INDEX idx_833a6197ea9fdd75 ON sylius_cms_section_media'); + $this->addSql('CREATE INDEX IDX_665F6C81EA9FDD75 ON sylius_cms_section_media (media_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons DROP FOREIGN KEY FK_B4D0B7CEDE13F470'); + $this->addSql('DROP INDEX idx_b4d0b7cee9ed820c ON sylius_cms_block_products_in_taxons'); + $this->addSql('CREATE INDEX IDX_DAA9DD18E9ED820C ON sylius_cms_block_products_in_taxons (block_id)'); + $this->addSql('DROP INDEX idx_b4d0b7cede13f470 ON sylius_cms_block_products_in_taxons'); + $this->addSql('CREATE INDEX IDX_DAA9DD18DE13F470 ON sylius_cms_block_products_in_taxons (taxon_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products_in_taxons ADD CONSTRAINT FK_B4D0B7CEDE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B272EA9FDD75'); + $this->addSql('ALTER TABLE sylius_cms_media_channels DROP FOREIGN KEY FK_2538B27272F5A1AA'); + $this->addSql('DROP INDEX idx_2538b27272f5a1aa ON sylius_cms_media_channels'); + $this->addSql('CREATE INDEX IDX_D109622E72F5A1AA ON sylius_cms_media_channels (channel_id)'); + $this->addSql('DROP INDEX idx_2538b272ea9fdd75 ON sylius_cms_media_channels'); + $this->addSql('CREATE INDEX IDX_D109622EEA9FDD75 ON sylius_cms_media_channels (media_id)'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B272EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_channels ADD CONSTRAINT FK_2538B27272F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_pages DROP FOREIGN KEY FK_2C0728F8C4663E4'); + $this->addSql('DROP INDEX idx_2c0728f8d823e37a ON sylius_cms_section_pages'); + $this->addSql('CREATE INDEX IDX_C96225EED823E37A ON sylius_cms_section_pages (section_id)'); + $this->addSql('DROP INDEX idx_2c0728f8c4663e4 ON sylius_cms_section_pages'); + $this->addSql('CREATE INDEX IDX_C96225EEC4663E4 ON sylius_cms_section_pages (page_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_pages ADD CONSTRAINT FK_2C0728F8C4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('DROP INDEX uniq_74157e9277153098 ON sylius_cms_media'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_DB2BB2E177153098 ON sylius_cms_media (code)'); + $this->addSql('DROP INDEX uniq_74157e92b548b0f ON sylius_cms_media'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_DB2BB2E1B548B0F ON sylius_cms_media (path)'); + $this->addSql('ALTER TABLE sylius_cms_page DROP FOREIGN KEY FK_2C2740B2F56F16CF'); + $this->addSql('DROP INDEX idx_2c2740b2f56f16cf ON sylius_cms_page'); + $this->addSql('CREATE INDEX IDX_18F07F1BF56F16CF ON sylius_cms_page (teaser_image_id)'); + $this->addSql('DROP INDEX uniq_2c2740b277153098 ON sylius_cms_page'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_18F07F1B77153098 ON sylius_cms_page (code)'); + $this->addSql('ALTER TABLE sylius_cms_page ADD CONSTRAINT FK_2C2740B2F56F16CF FOREIGN KEY (teaser_image_id) REFERENCES sylius_cms_media (id) ON DELETE SET NULL'); + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602FE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_channels DROP FOREIGN KEY FK_7026602F72F5A1AA'); + $this->addSql('DROP INDEX idx_7026602f72f5a1aa ON sylius_cms_block_channels'); + $this->addSql('CREATE INDEX IDX_8417B07372F5A1AA ON sylius_cms_block_channels (channel_id)'); + $this->addSql('DROP INDEX idx_7026602fe9ed820c ON sylius_cms_block_channels'); + $this->addSql('CREATE INDEX IDX_8417B073E9ED820C ON sylius_cms_block_channels (block_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602FE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_channels ADD CONSTRAINT FK_7026602F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C3E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_products DROP FOREIGN KEY FK_3088D8C34584665A'); + $this->addSql('DROP INDEX idx_3088d8c3e9ed820c ON sylius_cms_block_products'); + $this->addSql('CREATE INDEX IDX_C4B9089FE9ED820C ON sylius_cms_block_products (block_id)'); + $this->addSql('DROP INDEX idx_3088d8c34584665a ON sylius_cms_block_products'); + $this->addSql('CREATE INDEX IDX_C4B9089F4584665A ON sylius_cms_block_products (product_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C3E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_products ADD CONSTRAINT FK_3088D8C34584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE559DFD1'); + $this->addSql('DROP INDEX idx_49c0aace9ed820c ON sylius_cms_block_locales'); + $this->addSql('CREATE INDEX IDX_E1F907BAE9ED820C ON sylius_cms_block_locales (block_id)'); + $this->addSql('DROP INDEX idx_49c0aace559dfd1 ON sylius_cms_block_locales'); + $this->addSql('CREATE INDEX IDX_E1F907BAE559DFD1 ON sylius_cms_block_locales (locale_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE559DFD1 FOREIGN KEY (locale_id) REFERENCES sylius_locale (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_media_translation DROP FOREIGN KEY FK_AAAC4A922C2AC5D3'); + $this->addSql('DROP INDEX idx_aaac4a922c2ac5d3 ON sylius_cms_media_translation'); + $this->addSql('CREATE INDEX IDX_1FEC58972C2AC5D3 ON sylius_cms_media_translation (translatable_id)'); + $this->addSql('DROP INDEX sylius_cms_media_translation_uniq_trans ON sylius_cms_media_translation'); + $this->addSql('CREATE UNIQUE INDEX bitbag_cms_media_translation_uniq_trans ON sylius_cms_media_translation (translatable_id, locale)'); + $this->addSql('ALTER TABLE sylius_cms_media_translation ADD CONSTRAINT FK_AAAC4A922C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7FC4663E4'); + $this->addSql('ALTER TABLE sylius_cms_page_channels DROP FOREIGN KEY FK_E8AF4F7F72F5A1AA'); + $this->addSql('DROP INDEX idx_e8af4f7fc4663e4 ON sylius_cms_page_channels'); + $this->addSql('CREATE INDEX IDX_DCA4269C4663E4 ON sylius_cms_page_channels (page_id)'); + $this->addSql('DROP INDEX idx_e8af4f7f72f5a1aa ON sylius_cms_page_channels'); + $this->addSql('CREATE INDEX IDX_DCA426972F5A1AA ON sylius_cms_page_channels (channel_id)'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7FC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_channels ADD CONSTRAINT FK_E8AF4F7F72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DE9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP FOREIGN KEY FK_BB97608DC4663E4'); + $this->addSql('DROP INDEX idx_bb97608de9ed820c ON sylius_cms_content_configuration'); + $this->addSql('CREATE INDEX IDX_D899EFA7E9ED820C ON sylius_cms_content_configuration (block_id)'); + $this->addSql('DROP INDEX idx_bb97608dc4663e4 ON sylius_cms_content_configuration'); + $this->addSql('CREATE INDEX IDX_D899EFA7C4663E4 ON sylius_cms_content_configuration (page_id)'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id)'); + $this->addSql('ALTER TABLE sylius_cms_content_configuration ADD CONSTRAINT FK_BB97608DC4663E4 FOREIGN KEY (page_id) REFERENCES sylius_cms_page (id)'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_media DROP FOREIGN KEY FK_665F6C81EA9FDD75'); + $this->addSql('DROP INDEX idx_665f6c81ea9fdd75 ON sylius_cms_section_media'); + $this->addSql('CREATE INDEX IDX_833A6197EA9FDD75 ON sylius_cms_section_media (media_id)'); + $this->addSql('DROP INDEX idx_665f6c81d823e37a ON sylius_cms_section_media'); + $this->addSql('CREATE INDEX IDX_833A6197D823E37A ON sylius_cms_section_media (section_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_media ADD CONSTRAINT FK_665F6C81EA9FDD75 FOREIGN KEY (media_id) REFERENCES sylius_cms_media (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928D823E37A'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks DROP FOREIGN KEY FK_5DE81928E9ED820C'); + $this->addSql('DROP INDEX idx_5de81928d823e37a ON sylius_cms_section_blocks'); + $this->addSql('CREATE INDEX IDX_A9D9C974D823E37A ON sylius_cms_section_blocks (section_id)'); + $this->addSql('DROP INDEX idx_5de81928e9ed820c ON sylius_cms_section_blocks'); + $this->addSql('CREATE INDEX IDX_A9D9C974E9ED820C ON sylius_cms_section_blocks (block_id)'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928D823E37A FOREIGN KEY (section_id) REFERENCES sylius_cms_section (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_section_blocks ADD CONSTRAINT FK_5DE81928E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_page_translation DROP FOREIGN KEY FK_6D0D401B2C2AC5D3'); + $this->addSql('DROP INDEX sylius_cms_page_translation_uniq_trans ON sylius_cms_page_translation'); + $this->addSql('CREATE UNIQUE INDEX bitbag_cms_page_translation_uniq_trans ON sylius_cms_page_translation (translatable_id, locale)'); + $this->addSql('DROP INDEX idx_6d0d401b2c2ac5d3 ON sylius_cms_page_translation'); + $this->addSql('CREATE INDEX IDX_FDD074A62C2AC5D3 ON sylius_cms_page_translation (translatable_id)'); + $this->addSql('ALTER TABLE sylius_cms_page_translation ADD CONSTRAINT FK_6D0D401B2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_cms_page (id) ON DELETE CASCADE'); + $this->addSql('DROP INDEX uniq_d4dd0c0777153098 ON sylius_cms_section'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_421D079777153098 ON sylius_cms_section (code)'); + $this->addSql('DROP INDEX uniq_9d2248bc77153098 ON sylius_cms_block'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_321C84CF77153098 ON sylius_cms_block (code)'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03E9ED820C'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons DROP FOREIGN KEY FK_5397DD03DE13F470'); + $this->addSql('DROP INDEX idx_5397dd03de13f470 ON sylius_cms_block_taxons'); + $this->addSql('CREATE INDEX IDX_E324C6CEDE13F470 ON sylius_cms_block_taxons (taxon_id)'); + $this->addSql('DROP INDEX idx_5397dd03e9ed820c ON sylius_cms_block_taxons'); + $this->addSql('CREATE INDEX IDX_E324C6CEE9ED820C ON sylius_cms_block_taxons (block_id)'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03E9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_taxons ADD CONSTRAINT FK_5397DD03DE13F470 FOREIGN KEY (taxon_id) REFERENCES sylius_taxon (id) ON DELETE CASCADE'); + } +} diff --git a/src/Migrations/Version20240910113936.php b/src/Migrations/Version20240910113936.php new file mode 100644 index 000000000..f65ad059e --- /dev/null +++ b/src/Migrations/Version20240910113936.php @@ -0,0 +1,36 @@ +addSql('ALTER TABLE sylius_cms_page DROP FOREIGN KEY FK_2C2740B2F56F16CF'); + $this->addSql('DROP INDEX IDX_2C2740B2F56F16CF ON sylius_cms_page'); + $this->addSql('ALTER TABLE sylius_cms_page DROP teaser_image_id, DROP teaser_title, DROP teaser_content'); + $this->addSql('ALTER TABLE sylius_cms_page_translation ADD teaser_image_id INT DEFAULT NULL, ADD teaser_title VARCHAR(255) DEFAULT NULL, ADD teaser_content LONGTEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE sylius_cms_page_translation ADD CONSTRAINT FK_6D0D401BF56F16CF FOREIGN KEY (teaser_image_id) REFERENCES sylius_cms_media (id) ON DELETE SET NULL'); + $this->addSql('CREATE INDEX IDX_6D0D401BF56F16CF ON sylius_cms_page_translation (teaser_image_id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE sylius_cms_page ADD teaser_image_id INT DEFAULT NULL, ADD teaser_title VARCHAR(255) DEFAULT NULL, ADD teaser_content LONGTEXT DEFAULT NULL'); + $this->addSql('ALTER TABLE sylius_cms_page ADD CONSTRAINT FK_2C2740B2F56F16CF FOREIGN KEY (teaser_image_id) REFERENCES sylius_cms_media (id) ON DELETE SET NULL'); + $this->addSql('CREATE INDEX IDX_2C2740B2F56F16CF ON sylius_cms_page (teaser_image_id)'); + $this->addSql('ALTER TABLE sylius_cms_page_translation DROP FOREIGN KEY FK_6D0D401BF56F16CF'); + $this->addSql('DROP INDEX IDX_6D0D401BF56F16CF ON sylius_cms_page_translation'); + $this->addSql('ALTER TABLE sylius_cms_page_translation DROP teaser_image_id, DROP teaser_title, DROP teaser_content'); + } +} diff --git a/src/Migrations/Version20240912094638.php b/src/Migrations/Version20240912094638.php new file mode 100644 index 000000000..80e6e51ae --- /dev/null +++ b/src/Migrations/Version20240912094638.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE sylius_cms_content_configuration ADD locale VARCHAR(255) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE sylius_cms_content_configuration DROP locale'); + } +} diff --git a/src/Migrations/Version20240916100051.php b/src/Migrations/Version20240916100051.php new file mode 100644 index 000000000..a7ee9501f --- /dev/null +++ b/src/Migrations/Version20240916100051.php @@ -0,0 +1,30 @@ +addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE559DFD1'); + $this->addSql('ALTER TABLE sylius_cms_block_locales DROP FOREIGN KEY FK_49C0AACE9ED820C'); + $this->addSql('DROP TABLE sylius_cms_block_locales'); + } + + public function down(Schema $schema): void + { + $this->addSql('CREATE TABLE sylius_cms_block_locales (block_id INT NOT NULL, locale_id INT NOT NULL, INDEX IDX_49C0AACE9ED820C (block_id), INDEX IDX_49C0AACE559DFD1 (locale_id), PRIMARY KEY(block_id, locale_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE559DFD1 FOREIGN KEY (locale_id) REFERENCES sylius_locale (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE sylius_cms_block_locales ADD CONSTRAINT FK_49C0AACE9ED820C FOREIGN KEY (block_id) REFERENCES sylius_cms_block (id) ON DELETE CASCADE'); + } +} diff --git a/src/Processor/ImportProcessor.php b/src/Processor/ImportProcessor.php index 2b32379a9..f06277dab 100644 --- a/src/Processor/ImportProcessor.php +++ b/src/Processor/ImportProcessor.php @@ -1,19 +1,13 @@ importerChain->getImporterForResource($resourceCode); + $importer = $this->importerChain->getImporterForResource($resourceName); $data = $this->reader->read($filePath); foreach ($data as $index => $row) { try { $importer->import($row); } catch (\Exception $exception) { - $index += 1; + ++$index; throw new ImportFailedException($exception->getMessage(), $index); } diff --git a/src/Processor/ImportProcessorInterface.php b/src/Processor/ImportProcessorInterface.php index 325e045a6..8760fc1eb 100644 --- a/src/Processor/ImportProcessorInterface.php +++ b/src/Processor/ImportProcessorInterface.php @@ -1,14 +1,8 @@ setHeaderOffset(0)->getIterator(); + return Reader::createFromPath($filePath)->setHeaderOffset(0)->getIterator(); } } diff --git a/src/Reader/ReaderInterface.php b/src/Reader/ReaderInterface.php index 71eb55e79..4aaa54490 100755 --- a/src/Reader/ReaderInterface.php +++ b/src/Reader/ReaderInterface.php @@ -1,14 +1,8 @@ template = $template; + } + + public function setTwigEnvironment(Environment $twig): void + { + $this->twig = $twig; + } +} diff --git a/src/Renderer/ContentElement/ContentElementRendererInterface.php b/src/Renderer/ContentElement/ContentElementRendererInterface.php index 9a3f2746f..add27e6dd 100644 --- a/src/Renderer/ContentElement/ContentElementRendererInterface.php +++ b/src/Renderer/ContentElement/ContentElementRendererInterface.php @@ -1,16 +1,10 @@ getType(); @@ -31,8 +20,8 @@ public function render(ContentConfigurationInterface $contentConfiguration): str $headingType = $configuration['heading_type']; $headingContent = $configuration['heading']; - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_heading.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'heading_type' => $headingType, 'heading_content' => $headingContent, ]); diff --git a/src/Renderer/ContentElement/MultipleMediaContentElementRenderer.php b/src/Renderer/ContentElement/MultipleMediaContentElementRenderer.php index 821d937b4..940221ee5 100644 --- a/src/Renderer/ContentElement/MultipleMediaContentElementRenderer.php +++ b/src/Renderer/ContentElement/MultipleMediaContentElementRenderer.php @@ -1,26 +1,18 @@ twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_multiple_media.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'media' => $media, ]); } diff --git a/src/Renderer/ContentElement/PagesCollectionContentElementRenderer.php b/src/Renderer/ContentElement/PagesCollectionContentElementRenderer.php index 543d18d0a..09899c3b2 100644 --- a/src/Renderer/ContentElement/PagesCollectionContentElementRenderer.php +++ b/src/Renderer/ContentElement/PagesCollectionContentElementRenderer.php @@ -1,25 +1,17 @@ collectionRepository->findOneBy(['code' => $code]); - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_pages_collection.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'collection' => $collection?->getPages(), ]); } diff --git a/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php b/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php index 14a47edb0..a8963857b 100644 --- a/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php @@ -1,26 +1,18 @@ productRepository->findByTaxon($taxon); - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'products' => $products, ]); } diff --git a/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php b/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php index 180290e98..058f234d4 100644 --- a/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php @@ -1,24 +1,16 @@ twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'products' => $products, ]); } diff --git a/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php b/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php index c704ae08a..3f8743e16 100644 --- a/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php @@ -1,26 +1,18 @@ productRepository->findByTaxon($taxon); - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_grid.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'products' => $products, ]); } diff --git a/src/Renderer/ContentElement/ProductsGridContentElementRenderer.php b/src/Renderer/ContentElement/ProductsGridContentElementRenderer.php index 1b24a451f..5fd30d311 100644 --- a/src/Renderer/ContentElement/ProductsGridContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsGridContentElementRenderer.php @@ -1,24 +1,16 @@ productRepository->findBy(['code' => $productsCodes]); - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_grid.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'products' => $products, ]); } diff --git a/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php b/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php index 348b705ed..fb005ab1d 100644 --- a/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php +++ b/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php @@ -1,25 +1,17 @@ $this->mediaRepository->findOneBy(['code' => $code]), ]; - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_single_media.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'media' => $media, ]); } diff --git a/src/Renderer/ContentElement/SpacerContentElementRenderer.php b/src/Renderer/ContentElement/SpacerContentElementRenderer.php index ed52840a3..99dbc8c69 100644 --- a/src/Renderer/ContentElement/SpacerContentElementRenderer.php +++ b/src/Renderer/ContentElement/SpacerContentElementRenderer.php @@ -1,25 +1,14 @@ getType(); @@ -29,8 +18,8 @@ public function render(ContentConfigurationInterface $contentConfiguration): str { $configuration = (int) $contentConfiguration->getConfiguration()['spacer']; - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_spacer.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'spacer_height' => $configuration, ]); } diff --git a/src/Renderer/ContentElement/TaxonsListContentElementRenderer.php b/src/Renderer/ContentElement/TaxonsListContentElementRenderer.php index de28c149a..78c463b49 100644 --- a/src/Renderer/ContentElement/TaxonsListContentElementRenderer.php +++ b/src/Renderer/ContentElement/TaxonsListContentElementRenderer.php @@ -1,24 +1,16 @@ taxonRepository->findBy(['code' => $taxonsCodes]); - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_taxons_list.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'taxons' => $taxons, ]); } diff --git a/src/Renderer/ContentElement/TextareaContentElementRenderer.php b/src/Renderer/ContentElement/TextareaContentElementRenderer.php index 46674d8ec..2b666d076 100644 --- a/src/Renderer/ContentElement/TextareaContentElementRenderer.php +++ b/src/Renderer/ContentElement/TextareaContentElementRenderer.php @@ -1,25 +1,14 @@ getType(); @@ -27,8 +16,8 @@ public function supports(ContentConfigurationInterface $contentConfiguration): b public function render(ContentConfigurationInterface $contentConfiguration): string { - return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ - 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_textarea.html.twig', + return $this->twig->render('@SyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ + 'content_element' => $this->template, 'content' => $contentConfiguration->getConfiguration()['textarea'], ]); } diff --git a/src/Renderer/ContentElementRendererStrategy.php b/src/Renderer/ContentElementRendererStrategy.php index 7dd645e35..2f4fc6bc9 100644 --- a/src/Renderer/ContentElementRendererStrategy.php +++ b/src/Renderer/ContentElementRendererStrategy.php @@ -1,19 +1,14 @@ getContentElements() as $contentElement) { + if ($contentElement->getLocale() !== $this->localeContext->getLocaleCode()) { + continue; + } + foreach ($this->renderers as $renderer) { if ($renderer->supports($contentElement)) { $content .= html_entity_decode($renderer->render($contentElement), \ENT_QUOTES); diff --git a/src/Renderer/ContentElementRendererStrategyInterface.php b/src/Renderer/ContentElementRendererStrategyInterface.php index e895b8bf1..8f937d985 100644 --- a/src/Renderer/ContentElementRendererStrategyInterface.php +++ b/src/Renderer/ContentElementRendererStrategyInterface.php @@ -1,17 +1,11 @@ $this->urlGenerator->generate( - 'bitbag_sylius_cms_plugin_shop_page_show', + 'sylius_cms_shop_page_show', ['slug' => $page->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL, ), diff --git a/src/Renderer/PageLinkRendererInterface.php b/src/Renderer/PageLinkRendererInterface.php index a7a80001b..ed9c23385 100644 --- a/src/Renderer/PageLinkRendererInterface.php +++ b/src/Renderer/PageLinkRendererInterface.php @@ -1,16 +1,10 @@ localeRepository->findOneBy(['code' => $this->localeContext->getLocaleCode()]); - Assert::notNull($locale); - - if (false === $block->hasLocale($locale) && 0 !== $block->getLocales()->count()) { - $this->logger->warning(sprintf( - 'Block with "%s" code was found in the database, but it does not have "%s" locale.', - $code, - $this->localeContext->getLocaleCode(), - )); - - return null; - } - return $block; } } diff --git a/src/Resolver/BlockResourceResolverInterface.php b/src/Resolver/BlockResourceResolverInterface.php index cd5317ec2..1c28c19d8 100755 --- a/src/Resolver/BlockResourceResolverInterface.php +++ b/src/Resolver/BlockResourceResolverInterface.php @@ -1,16 +1,10 @@ factory, $factoryMethod]; if (is_callable($callback) && method_exists($this->factory, $factoryMethod)) { - return call_user_func($callback); + return $callback(); } throw new BadFunctionCallException('Provided method' . $factoryMethod . ' is not callable'); diff --git a/src/Resolver/ResourceResolverInterface.php b/src/Resolver/ResourceResolverInterface.php index 33beb1227..aa151a10d 100644 --- a/src/Resolver/ResourceResolverInterface.php +++ b/src/Resolver/ResourceResolverInterface.php @@ -1,14 +1,8 @@ { - const cmsLoadTemplate = $('[data-bb-cms-load-template]'); - const cmsPageTemplate = $('#bitbag_sylius_cms_plugin_page_template'); - const cmsBlockTemplate = $('#bitbag_sylius_cms_plugin_block_template'); - - cmsLoadTemplate.on('click', function (e) { - e.preventDefault(); - - if (!cmsPageTemplate.val() && !cmsBlockTemplate.val()) { - return; - } - - $('#load-template-confirmation-modal').modal('show'); - }); - - $('#load-template-confirmation-button').on('click', function () { - const templateId = cmsPageTemplate.val() ?? cmsBlockTemplate.val(); - if (!templateId) { - return; - } - - const endpointUrl = cmsLoadTemplate.data('bb-cms-load-template').replace('REPLACE_ID', templateId); - if (!endpointUrl) { - return; - } - - $.ajax({ - url: endpointUrl, - type: 'GET', - success: function(data) { - if (data.status === 'success') { - $('[id^="bitbag_sylius_cms_plugin_"][id$="contentElements"]') - .children('[data-form-collection="list"]') - .html(''); - - $.each(data.content, function () { - $('[data-form-collection="add"]').trigger('click'); - }); - - const elements = $('[id^="bitbag_sylius_cms_plugin_"][id*="_contentElements_"][id$="_type"]').filter(function() { - return /_page_|_block_/.test(this.id); - }); - - $.each(data.content, function (index, element) { - elements.eq(index).val(element.type); - elements.eq(index).change(); - }); - } else { - console.error(data.message); - } - }, - error: function(jqXHR, textStatus, errorThrown) { - console.error('Error:', textStatus, errorThrown); - } - }); - }); - }); - } -} - -export default HandleTemplate; diff --git a/src/Resources/assets/admin/js/bitbag/index.js b/src/Resources/assets/admin/js/bitbag/index.js deleted file mode 100644 index a45ef41e2..000000000 --- a/src/Resources/assets/admin/js/bitbag/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import './bitbag-content-configuration'; -export {HandleCsvUpload} from './bitbag-upload-csv'; -export {HandleSlugUpdate} from './bitbag-page-slug'; -export {HandlePreview} from './bitbag-cms-preview'; -export {HandleAutoComplete} from './bitbag-media-autocomplete'; -export {HandleChooseCollectionType} from './bitbag-choose-collection-type'; -export {HandleTemplate} from './bitbag-template'; diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-choose-collection-type.js b/src/Resources/assets/admin/js/cms/cms-choose-collection-type.js similarity index 69% rename from src/Resources/assets/admin/js/bitbag/bitbag-choose-collection-type.js rename to src/Resources/assets/admin/js/cms/cms-choose-collection-type.js index f2b39f95c..6f29493ee 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-choose-collection-type.js +++ b/src/Resources/assets/admin/js/cms/cms-choose-collection-type.js @@ -1,13 +1,7 @@ -/* - * This file was created by developers working at BitBag - * Do you need more information about us and what we do? Visit our https://bitbag.io website! - * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - export class HandleChooseCollectionType { init() { window.addEventListener('DOMContentLoaded', () => { - const typeField = document.getElementById('bitbag_sylius_cms_plugin_collection_type'); + const typeField = document.getElementById('sylius_cms_collection_type'); const fields = { page: document.getElementById('collection-type-pages'), block: document.getElementById('collection-type-blocks'), diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-content-configuration.js b/src/Resources/assets/admin/js/cms/cms-content-configuration.js similarity index 74% rename from src/Resources/assets/admin/js/bitbag/bitbag-content-configuration.js rename to src/Resources/assets/admin/js/cms/cms-content-configuration.js index 4e5739019..1320437a4 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-content-configuration.js +++ b/src/Resources/assets/admin/js/cms/cms-content-configuration.js @@ -1,11 +1,33 @@ -/* - * This file was created by developers working at BitBag - * Do you need more information about us and what we do? Visit our https://bitbag.io website! - * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - $(document).ready(function() { - $('.bitbag-media-autocomplete, .sylius-autocomplete').each((index, element) => { + const localeSelector = $('.locale-selector'); + const contentElementsContainer = $('.content-elements-container'); + + function updateContentElementsVisibility() { + const selectedLocale = localeSelector.val(); + + contentElementsContainer.find('.bb-collection-item').each(function() { + const $element = $(this); + const elementLocale = $element.find('input[name$="[locale]"]').val(); + + if (elementLocale === selectedLocale) { + $element.show(); + } else { + $element.hide(); + } + }); + } + + localeSelector.on('change', function() { + updateContentElementsVisibility(); + }); + + contentElementsContainer.on('contentElementAdded', function() { + updateContentElementsVisibility(); + }); + + updateContentElementsVisibility(); + + $('.cms-media-autocomplete, .sylius-autocomplete').each((index, element) => { $(element).autoComplete(); }); @@ -25,12 +47,12 @@ $(document).ready(function() { extraPlugins: ["mediaVideo", "mediaImage"], removePlugins: ["exportpdf"], filebrowserUploadUrl: "/admin/editor/upload-image", - bodyId: "bitbag-ckeditor", + bodyId: "cms-ckeditor", language: "en-us" }; - let pageElements = '#bitbag_sylius_cms_plugin_page_contentElements'; - let blockElements = '#bitbag_sylius_cms_plugin_block_contentElements'; + let pageElements = '#sylius_cms_page_contentElements'; + let blockElements = '#sylius_cms_block_contentElements'; let collectionHolder = $(pageElements).length ? pageElements : blockElements; let itemElement = document.querySelector(`${collectionHolder} [data-form-collection="item"]`); @@ -40,7 +62,7 @@ $(document).ready(function() { } $(document).on('collection-form-add', () => { - $('.bitbag-media-autocomplete, .sylius-autocomplete').each((index, element) => { + $('.cms-media-autocomplete, .sylius-autocomplete').each((index, element) => { if ($._data($(element).get(0), 'events') === undefined) { $(element).autoComplete(); } @@ -49,8 +71,9 @@ $(document).ready(function() { $(`${collectionHolder} [data-form-collection="item"]`).each((index, element) => { $(document).loadContentConfiguration(element); }); - }); + $('.bb-collection-item:last-child').find('input[name$="[locale]"]').val(localeSelector.val()); + }); $.fn.extend({ loadContentConfiguration(target) { target.querySelector(`${collectionHolder} select[name*="type"]`).onchange = function () { @@ -58,36 +81,28 @@ $(document).ready(function() { const newConfig = document.createElement('div'); const selectedOption = this.selectedOptions[0]; newConfig.innerHTML = selectedOption.getAttribute('data-configuration'); - const oldConfig = parent.nextElementSibling; - parent.parentElement.replaceChild(newConfig, oldConfig); - let oldConfigInput = oldConfig.querySelector('input'); if (!oldConfigInput) { oldConfigInput = oldConfig.querySelector('textarea'); } - const oldConfigInputName = oldConfigInput.getAttribute('name'); - let newConfigInputs = newConfig.querySelectorAll('input'); if (!newConfigInputs.length) { newConfigInputs = newConfig.querySelectorAll('textarea'); } - newConfigInputs.forEach(element => { let newConfigInputName = element.getAttribute('name'); if (!newConfigInputName) { return; } - newConfigInputName = oldConfigInputName.replace( oldConfigInputName.substring(oldConfigInputName.indexOf('[configuration]') + 15), newConfigInputName.substring(newConfigInputName.indexOf('configuration') + 13), ); - $(element).attr('name', newConfigInputName); - $(newConfig).find('.bitbag-media-autocomplete').autoComplete(); + $(newConfig).find('.cms-media-autocomplete').autoComplete(); $(newConfig).find('.sylius-autocomplete').autoComplete(); if (this.value === 'textarea') { @@ -101,7 +116,6 @@ $(document).ready(function() { } } }); - $(`${collectionHolder} [data-form-collection="item"]`).each((index, element) => { $(document).loadContentConfiguration(element); }); diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-media-autocomplete.js b/src/Resources/assets/admin/js/cms/cms-media-autocomplete.js similarity index 92% rename from src/Resources/assets/admin/js/bitbag/bitbag-media-autocomplete.js rename to src/Resources/assets/admin/js/cms/cms-media-autocomplete.js index d132c78b3..d2750e75f 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-media-autocomplete.js +++ b/src/Resources/assets/admin/js/cms/cms-media-autocomplete.js @@ -1,8 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ import triggerCustomEvent from '../../../common/js/utilities/triggerCustomEvent'; export class HandleAutoComplete { @@ -33,7 +28,7 @@ export class HandleAutoComplete { init() { if (typeof this.config !== 'object') { - throw new Error('Bitbag CMS Plugin - HandleAutoComplete class config is not a valid object'); + throw new Error('Sylius CMS Plugin - HandleAutoComplete class config is not a valid object'); } this.mediaContainers.forEach((mediaContainer) => { this._handleSavedValue(mediaContainer); @@ -113,7 +108,7 @@ export class HandleAutoComplete { triggerCustomEvent(mediaContainer, 'cms.media.saved.reload.completed', data); } catch (error) { - console.error(`BitBag CMS Plugin - HandleAutoComplete class error : ${error}`); + console.error(`Sylius CMS Plugin - HandleAutoComplete class error : ${error}`); triggerCustomEvent(mediaContainer, 'cms.media.saved.reload.error', error); } finally { mediaContainer.classList.remove('loading'); @@ -139,7 +134,7 @@ export class HandleAutoComplete { triggerCustomEvent(mediaContainer, 'cms.media.display.completed', data); } catch (error) { - console.error(`BitBag CMS Plugin - HandleAutoComplete class error : ${error}`); + console.error(`Sylius CMS Plugin - HandleAutoComplete class error : ${error}`); triggerCustomEvent(mediaContainer, 'cms.media.display.error', error); } finally { mediaContainer.classList.remove('loading'); diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-page-slug.js b/src/Resources/assets/admin/js/cms/cms-page-slug.js similarity index 81% rename from src/Resources/assets/admin/js/bitbag/bitbag-page-slug.js rename to src/Resources/assets/admin/js/cms/cms-page-slug.js index bd146b03a..e27df10c4 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-page-slug.js +++ b/src/Resources/assets/admin/js/cms/cms-page-slug.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - import triggerCustomEvent from '../../../common/js/utilities/triggerCustomEvent'; export class HandleSlugUpdate { @@ -11,8 +5,8 @@ export class HandleSlugUpdate { config = { wrappersIndicator: 'data-bb-cms-wrapper', lockFieldIndicator: 'data-bb-cms-toggle-slug', - bbTarget: 'bitbag_sylius_cms_plugin_page', - nameField: 'bitbag_sylius_cms_plugin_page_name', + bbTarget: 'sylius_cms_page', + nameField: 'sylius_cms_page_name', } ) { this.wrappers = document.querySelectorAll(`[${config.wrappersIndicator}]`); @@ -24,15 +18,15 @@ export class HandleSlugUpdate { init() { if (typeof this.config !== 'object') { - throw new Error('Bitbag CMS Plugin - HandleSlugUpdate class config is not a valid object'); + throw new Error('Sylius CMS Plugin - HandleSlugUpdate class config is not a valid object'); } if (typeof this.lockFieldIndicator !== 'string' || typeof this.bbTarget !== 'string') { - throw new Error('Bitbag CMS Plugin - HandleSlugUpdate class config key values are not valid strings'); + throw new Error('Sylius CMS Plugin - HandleSlugUpdate class config key values are not valid strings'); } if (!this.nameField ) { - throw new Error('Bitbag CMS Plugin - HandleSlugUpdate name field not found'); + throw new Error('Sylius CMS Plugin - HandleSlugUpdate name field not found'); } this._handleFields(); @@ -90,7 +84,7 @@ export class HandleSlugUpdate { const response = await request.json(); return response.slug; } catch (error) { - console.error(`BitBag CMS Plugin - HandleSlugUpdate class error : ${error}`); + console.error(`Sylius CMS Plugin - HandleSlugUpdate class error : ${error}`); } } diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-cms-preview.js b/src/Resources/assets/admin/js/cms/cms-preview.js similarity index 87% rename from src/Resources/assets/admin/js/bitbag/bitbag-cms-preview.js rename to src/Resources/assets/admin/js/cms/cms-preview.js index e589b5a9b..9104531f3 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-cms-preview.js +++ b/src/Resources/assets/admin/js/cms/cms-preview.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - import triggerCustomEvent from '../../../common/js/utilities/triggerCustomEvent'; export class HandlePreview { @@ -24,14 +18,14 @@ export class HandlePreview { } init() { if (typeof this.config !== 'object') { - throw new Error('Bitbag CMS Plugin - HandlePreview class config is not a valid object'); + throw new Error('Sylius CMS Plugin - HandlePreview class config is not a valid object'); } if ( typeof this.localeSelector !== 'string' || typeof this.channelSelector !== 'string' || typeof this.modalSelector !== 'string' ) { - throw new Error('Bitbag CMS Plugin - HandlePreview class config key values are not valid strings'); + throw new Error('Sylius CMS Plugin - HandlePreview class config key values are not valid strings'); } this._resourcePreview(); } @@ -94,7 +88,7 @@ export class HandlePreview { this.modal.querySelector('iframe').src = blobUrl; triggerCustomEvent(this.modal, 'cms.create.preview.completed', res); } catch (error) { - console.error(`BitBag CMS Plugin - HandlePreview class error : ${error}`); + console.error(`Sylius CMS Plugin - HandlePreview class error : ${error}`); triggerCustomEvent(this.modal, 'cms.create.preview.error', error); } finally { this.modal.querySelector('.ui.loadable').classList.remove('loading'); diff --git a/src/Resources/assets/admin/js/cms/cms-template.js b/src/Resources/assets/admin/js/cms/cms-template.js new file mode 100644 index 000000000..87d631dc0 --- /dev/null +++ b/src/Resources/assets/admin/js/cms/cms-template.js @@ -0,0 +1,90 @@ +export class HandleTemplate { + init() { + $(document).ready(() => { + const cmsLoadTemplate = $('[data-bb-cms-load-template]'); + const cmsPageTemplate = $('#sylius_cms_page_template'); + const cmsBlockTemplate = $('#sylius_cms_block_template'); + + let locales = []; + $('.locale-selector option').each(function() { + locales.push($(this).val()); + }); + + cmsPageTemplate.on('change', function() { + if ($(this).val()) { + $('#load-template-confirmation-modal').modal('show'); + } + }); + + cmsBlockTemplate.on('change', function() { + if ($(this).val()) { + $('#load-template-confirmation-modal').modal('show'); + } + }); + + $('#load-template-confirmation-button').on('click', function () { + const templateId = cmsPageTemplate.val() ?? cmsBlockTemplate.val(); + if (!templateId) { + return; + } + + const endpointUrl = cmsLoadTemplate.data('bb-cms-load-template').replace('REPLACE_ID', templateId); + if (!endpointUrl) { + return; + } + + $.ajax({ + url: endpointUrl, + type: 'GET', + success: function(data) { + if (data.status === 'success') { + $('[id^="sylius_cms_"][id$="contentElements"]') + .children('[data-form-collection="list"]') + .html(''); + + $.each(data.content, function () { + locales.forEach(function (locale) { + $('[data-form-collection="add"]').trigger('click'); + }); + }); + + const elements = $('.bb-collection-item'); + let idx = 0; + $.each(data.content, function (index, element) { + locales.forEach(function (locale) { + elements.eq(idx).find('select:first').val(element.type); + elements.eq(idx).find('select:first').change(); + elements.eq(idx).find('input[name$="[locale]"]').val(locale); + idx++; + }); + }); + + $('.content-elements-container').find('.bb-collection-item').each(function() { + const $element = $(this); + const elementLocale = $element.find('input[name$="[locale]"]').val(); + + if (elementLocale === $('.locale-selector').val()) { + $element.show(); + } else { + $element.hide(); + } + }); + } else { + console.error(data.message); + } + }, + error: function(jqXHR, textStatus, errorThrown) { + console.error('Error:', textStatus, errorThrown); + } + }); + }); + + $('#load-template-cancel-button').on('click', function () { + cmsPageTemplate.val(''); + cmsBlockTemplate.val(''); + }); + }); + } +} + +export default HandleTemplate; diff --git a/src/Resources/assets/admin/js/bitbag/bitbag-upload-csv.js b/src/Resources/assets/admin/js/cms/cms-upload-csv.js similarity index 70% rename from src/Resources/assets/admin/js/bitbag/bitbag-upload-csv.js rename to src/Resources/assets/admin/js/cms/cms-upload-csv.js index bf2a9c145..00d4664ac 100644 --- a/src/Resources/assets/admin/js/bitbag/bitbag-upload-csv.js +++ b/src/Resources/assets/admin/js/cms/cms-upload-csv.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - export class HandleCsvUpload { constructor(config = {textField: 'data-bb-cms-text', fileField: 'data-bb-cms-file'}) { this.config = config; @@ -13,7 +7,7 @@ export class HandleCsvUpload { init() { if (typeof this.config !== 'object') { - throw new Error('Bitbag CMS Plugin - HandleCsvUpload class config is not a valid object'); + throw new Error('Sylius CMS Plugin - HandleCsvUpload class config is not a valid object'); } this._handleFields(); diff --git a/src/Resources/assets/admin/js/cms/index.js b/src/Resources/assets/admin/js/cms/index.js new file mode 100644 index 000000000..5ab24a4ec --- /dev/null +++ b/src/Resources/assets/admin/js/cms/index.js @@ -0,0 +1,7 @@ +import './cms-content-configuration'; +export {HandleCsvUpload} from './cms-upload-csv'; +export {HandleSlugUpdate} from './cms-page-slug'; +export {HandlePreview} from './cms-preview'; +export {HandleAutoComplete} from './cms-media-autocomplete'; +export {HandleChooseCollectionType} from './cms-choose-collection-type'; +export {HandleTemplate} from './cms-template'; diff --git a/src/Resources/assets/admin/js/index.js b/src/Resources/assets/admin/js/index.js index 498e17eca..a3587190b 100644 --- a/src/Resources/assets/admin/js/index.js +++ b/src/Resources/assets/admin/js/index.js @@ -5,7 +5,7 @@ import { HandleAutoComplete, HandleChooseCollectionType, HandleTemplate -} from './bitbag'; +} from './cms'; if (document.querySelector('[data-bb-target="cms-import"]')) { new HandleCsvUpload().init(); diff --git a/src/Resources/assets/admin/scss/_css.scss b/src/Resources/assets/admin/scss/_css.scss index d3c63c491..344383c19 100644 --- a/src/Resources/assets/admin/scss/_css.scss +++ b/src/Resources/assets/admin/scss/_css.scss @@ -1,21 +1,21 @@ -#bitbag-cms-resource-preview-modal { +#cms-resource-preview-modal { height: 100%; } -#bitbag-cms-resource-preview-modal iframe { +#cms-resource-preview-modal iframe { width: 100%; height: 100vh; } -#bitbag-cms-resource-preview-modal .ui.header { +#cms-resource-preview-modal .ui.header { padding-bottom: 0; } -.bitbag-cms-import .ui.action.input input[type='file'] { +.cms-import .ui.action.input input[type='file'] { display: none; } -.bitbag-cms-import .ui.action.input input[type='text'] { +.cms-import .ui.action.input input[type='text'] { width: auto; } @@ -96,11 +96,11 @@ } } -.bitbag-media-autocomplete .dropdown.icon { +.cms-media-autocomplete .dropdown.icon { pointer-events: none; } -.bitbag-media-autocomplete .search { +.cms-media-autocomplete .search { cursor: pointer !important; } diff --git a/src/Resources/assets/shop/scss/block/show.scss b/src/Resources/assets/shop/scss/block/show.scss index 4a687f347..b9487635c 100644 --- a/src/Resources/assets/shop/scss/block/show.scss +++ b/src/Resources/assets/shop/scss/block/show.scss @@ -1,4 +1,4 @@ -.bitbag-block { +.cms-block { margin-bottom: 20px; img { diff --git a/src/Resources/config/api_resources/Block.xml b/src/Resources/config/api_resources/Block.xml index 7e4f23d3d..7081e0991 100644 --- a/src/Resources/config/api_resources/Block.xml +++ b/src/Resources/config/api_resources/Block.xml @@ -3,42 +3,51 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd" > - + - shop:cms:read + sylius_cms:block:read:index + sylius_cms:block:read:show - + - shop:cms:write + sylius_cms:block:write sylius - + GET /shop/cms-plugin/blocks + + sylius_cms:block:read:index + - - + GET /shop/cms-plugin/blocks/{id} + + sylius_cms:block:read:show + + + - - + + + diff --git a/src/Resources/config/api_resources/Collection.xml b/src/Resources/config/api_resources/Collection.xml index 26a3340ff..88986b47f 100644 --- a/src/Resources/config/api_resources/Collection.xml +++ b/src/Resources/config/api_resources/Collection.xml @@ -3,37 +3,47 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd" > - + - shop:cms:read + sylius_cms:collection:read:index + sylius_cms:collection:read:show - + - shop:cms:write + sylius_cms:collection:write sylius - + GET /shop/cms-plugin/collections + + sylius_cms:collection:read:index + - - + GET /shop/cms-plugin/collections/{id} + + sylius_cms:collection:read:show + + + + + diff --git a/src/Resources/config/api_resources/Media.xml b/src/Resources/config/api_resources/Media.xml index 8a53fb1b4..a28b8999d 100644 --- a/src/Resources/config/api_resources/Media.xml +++ b/src/Resources/config/api_resources/Media.xml @@ -3,33 +3,39 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd" > - + - shop:cms:read + sylius_cms:media:read:index + sylius_cms:media:read:show - + - shop:cms:write + sylius_cms:media:write sylius - + GET /shop/cms-plugin/media + + sylius_cms:media:read:index + - - + GET /shop/cms-plugin/media/{id} + + sylius_cms:media:read:show + diff --git a/src/Resources/config/api_resources/Page.xml b/src/Resources/config/api_resources/Page.xml index d08734007..113bd64b4 100644 --- a/src/Resources/config/api_resources/Page.xml +++ b/src/Resources/config/api_resources/Page.xml @@ -3,33 +3,39 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd" > - + - shop:cms:read + sylius_cms:page:read:index + sylius_cms:page:read:show - + - shop:cms:write + sylius_cms:page:write sylius - + GET /shop/cms-plugin/pages + + sylius_cms:page:read:index + - - + GET /shop/cms-plugin/pages/{id} + + sylius_cms:page:read:show + @@ -42,5 +48,6 @@ + diff --git a/src/Resources/config/api_resources/Template.xml b/src/Resources/config/api_resources/Template.xml new file mode 100644 index 000000000..a6e41e630 --- /dev/null +++ b/src/Resources/config/api_resources/Template.xml @@ -0,0 +1,47 @@ + + + + + + sylius_cms:template:read:index + sylius_cms:template:read:show + + + + + + sylius_cms:template:write + + + + sylius + + + + GET + /shop/cms-plugin/templates + + sylius_cms:template:read:index + + + + + + + GET + /shop/cms-plugin/templates/{id} + + sylius_cms:template:read:show + + + + + + + + + + diff --git a/src/Resources/config/config.yml b/src/Resources/config/config.yml index e438cbd5c..ae1c09fc1 100755 --- a/src/Resources/config/config.yml +++ b/src/Resources/config/config.yml @@ -1,39 +1,38 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/resources.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/fos_ck_editor/fos_ck_editor.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/services.xml" } + - { resource: "@SyliusCmsPlugin/Resources/config/fos_ck_editor/fos_ck_editor.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/services.xml" } parameters: sylius.sitemap.path: "%kernel.project_dir%/var/sitemap" - bitbag_validation_group: [bitbag] - bitbag_sylius_cms_plugin.form.type.block.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.content_configuration.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.block_image.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.page.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.translation.page.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.collection.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.translation.media.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.media.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.form.type.template.validation_groups: "%bitbag_validation_group%" - bitbag_sylius_cms_plugin.uploader.filesystem: bitbag_sylius_cms_plugin_media + sylius_validation_group: [cms] + sylius_cms.form.type.block.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.content_configuration.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.block_image.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.page.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.translation.page.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.collection.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.translation.media.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.media.validation_groups: "%sylius_validation_group%" + sylius_cms.form.type.template.validation_groups: "%sylius_validation_group%" + sylius_cms.uploader.filesystem: sylius_cms_media jms_serializer: metadata: directories: - bitbag-section: - namespace_prefix: "BitBag\\SyliusCmsPlugin" - path: "@BitBagSyliusCmsPlugin/Resources/config/serializer" + cms-section: + namespace_prefix: "Sylius\\CmsPlugin" + path: "@SyliusCmsPlugin/Resources/config/serializer" knp_gaufrette: adapters: - bitbag_sylius_cms_plugin_media: + sylius_cms_media: local: directory: "%sylius_core.public_dir%" create: true filesystems: - bitbag_sylius_cms_plugin_media: - adapter: "%bitbag_sylius_cms_plugin.uploader.filesystem%" + sylius_cms_media: + adapter: "%sylius_cms.uploader.filesystem%" liip_imagine: loaders: @@ -47,5 +46,5 @@ sylius_ui: sylius.admin.layout.javascripts: blocks: version_script: - template: "@BitBagSyliusCmsPlugin/Asset/_cmsVersionScript.html.twig" + template: "@SyliusCmsPlugin/Asset/_cmsVersionScript.html.twig" priority: 30 diff --git a/src/Resources/config/doctrine/Block.orm.xml b/src/Resources/config/doctrine/Block.orm.xml index 51f44b567..fea56d100 100644 --- a/src/Resources/config/doctrine/Block.orm.xml +++ b/src/Resources/config/doctrine/Block.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -16,10 +16,10 @@ - + - + @@ -29,7 +29,7 @@ - + @@ -38,19 +38,8 @@ - - - - - - - - - - - - + @@ -61,7 +50,7 @@ - + @@ -72,7 +61,7 @@ - + diff --git a/src/Resources/config/doctrine/Collection.orm.xml b/src/Resources/config/doctrine/Collection.orm.xml index 27a6f0893..ce82918e4 100644 --- a/src/Resources/config/doctrine/Collection.orm.xml +++ b/src/Resources/config/doctrine/Collection.orm.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -17,11 +17,11 @@ - + - + @@ -31,8 +31,8 @@ - - + + @@ -45,11 +45,11 @@ - + - + diff --git a/src/Resources/config/doctrine/ContentConfiguration.orm.xml b/src/Resources/config/doctrine/ContentConfiguration.orm.xml index a41d65b0e..b46c9f872 100644 --- a/src/Resources/config/doctrine/ContentConfiguration.orm.xml +++ b/src/Resources/config/doctrine/ContentConfiguration.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -18,11 +18,13 @@ - + + + - + diff --git a/src/Resources/config/doctrine/Media.orm.xml b/src/Resources/config/doctrine/Media.orm.xml index 6eedcf735..7ce6df21c 100644 --- a/src/Resources/config/doctrine/Media.orm.xml +++ b/src/Resources/config/doctrine/Media.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -26,10 +26,10 @@ - + - + @@ -39,7 +39,7 @@ - + diff --git a/src/Resources/config/doctrine/MediaTranslation.orm.xml b/src/Resources/config/doctrine/MediaTranslation.orm.xml index 5d24b667a..a68cb35ac 100644 --- a/src/Resources/config/doctrine/MediaTranslation.orm.xml +++ b/src/Resources/config/doctrine/MediaTranslation.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + diff --git a/src/Resources/config/doctrine/Page.orm.xml b/src/Resources/config/doctrine/Page.orm.xml index 7e26f5826..4f4a081ad 100644 --- a/src/Resources/config/doctrine/Page.orm.xml +++ b/src/Resources/config/doctrine/Page.orm.xml @@ -6,7 +6,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -27,10 +27,10 @@ - + - + @@ -40,7 +40,7 @@ - + @@ -49,13 +49,5 @@ - - - - - - - - diff --git a/src/Resources/config/doctrine/PageTranslation.orm.xml b/src/Resources/config/doctrine/PageTranslation.orm.xml index be6ae7f06..2968a0cdd 100644 --- a/src/Resources/config/doctrine/PageTranslation.orm.xml +++ b/src/Resources/config/doctrine/PageTranslation.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + @@ -17,5 +17,13 @@ + + + + + + + + diff --git a/src/Resources/config/doctrine/Template.orm.xml b/src/Resources/config/doctrine/Template.orm.xml index 12c49b4b9..3804931d1 100644 --- a/src/Resources/config/doctrine/Template.orm.xml +++ b/src/Resources/config/doctrine/Template.orm.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> - + diff --git a/src/Resources/config/fos_ck_editor/fos_ck_editor.yml b/src/Resources/config/fos_ck_editor/fos_ck_editor.yml index 2ef9a9dbb..e591d057a 100644 --- a/src/Resources/config/fos_ck_editor/fos_ck_editor.yml +++ b/src/Resources/config/fos_ck_editor/fos_ck_editor.yml @@ -1,8 +1,8 @@ fos_ck_editor: - default_config: bitbag_sylius_cms_plugin + default_config: sylius_cms configs: - bitbag_sylius_cms_plugin: - toolbar: bitbag_sylius_cms_plugin + sylius_cms: + toolbar: sylius_cms enterMode: 3 forcePasteAsPlainText: 'allow-word' allowedContent: true @@ -13,14 +13,14 @@ fos_ck_editor: - "exportpdf" plugins: mediaVideo: - path: '/bundles/bitbagsyliuscmsplugin/js/ckeditor-plugins/video/' + path: '/bundles/SyliusCmsPlugin/js/ckeditor-plugins/video/' filename: 'plugin.js' mediaImage: - path: '/bundles/bitbagsyliuscmsplugin/js/ckeditor-plugins/image/' + path: '/bundles/SyliusCmsPlugin/js/ckeditor-plugins/image/' filename: 'plugin.js' toolbars: configs: - bitbag_sylius_cms_plugin: + sylius_cms: - '@standard.clipboard' - '@standard.editing' - '@standard.links' diff --git a/src/Resources/config/grids.yml b/src/Resources/config/grids.yml index 3e22d5a0e..3bdbb63fa 100755 --- a/src/Resources/config/grids.yml +++ b/src/Resources/config/grids.yml @@ -1,8 +1,8 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/shop.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/shop.yml" } sylius_grid: templates: action: - import: "@BitBagSyliusCmsPlugin/Grid/Action/import.html.twig" + import: "@SyliusCmsPlugin/Grid/Action/import.html.twig" diff --git a/src/Resources/config/grids/admin.yml b/src/Resources/config/grids/admin.yml index 1ba6d4ad0..cbbed98f5 100755 --- a/src/Resources/config/grids/admin.yml +++ b/src/Resources/config/grids/admin.yml @@ -1,6 +1,6 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/block.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/page.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/collection.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/media.yml" } - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/admin/template.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/block.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/page.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/collection.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/media.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/admin/template.yml" } diff --git a/src/Resources/config/grids/admin/block.yml b/src/Resources/config/grids/admin/block.yml index 45f423591..d6c7902fa 100755 --- a/src/Resources/config/grids/admin/block.yml +++ b/src/Resources/config/grids/admin/block.yml @@ -1,21 +1,21 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_block: + sylius_cms_admin_block: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.block.class%" + class: "%sylius_cms.model.block.class%" sorting: code: asc limits: [10, 25, 50] fields: name: type: twig - label: bitbag_sylius_cms_plugin.ui.name + label: sylius_cms.ui.name sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/name.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string label: sylius.ui.code @@ -29,16 +29,16 @@ sylius_grid: template: "@SyliusUi/Grid/Field/enabled.html.twig" collections: type: twig - label: bitbag_sylius_cms_plugin.ui.collections + label: sylius_cms.ui.collections path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" channels: type: twig - label: bitbag_sylius_cms_plugin.ui.channels + label: sylius_cms.ui.channels path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string diff --git a/src/Resources/config/grids/admin/collection.yml b/src/Resources/config/grids/admin/collection.yml index 5e3282672..0f8492a48 100755 --- a/src/Resources/config/grids/admin/collection.yml +++ b/src/Resources/config/grids/admin/collection.yml @@ -1,28 +1,28 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_collection: + sylius_cms_admin_collection: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.collection.class%" + class: "%sylius_cms.model.collection.class%" sorting: code: asc limits: [10, 25, 50] fields: name: type: twig - label: bitbag_sylius_cms_plugin.ui.name + label: sylius_cms.ui.name sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/name.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ type: type: string - label: bitbag_sylius_cms_plugin.ui.type + label: sylius_cms.ui.type sortable: ~ filters: search: diff --git a/src/Resources/config/grids/admin/media.yml b/src/Resources/config/grids/admin/media.yml index 81f497047..24de6d2fb 100644 --- a/src/Resources/config/grids/admin/media.yml +++ b/src/Resources/config/grids/admin/media.yml @@ -1,10 +1,10 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_media: + sylius_cms_admin_media: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.media.class%" + class: "%sylius_cms.model.media.class%" repository: method: createListQueryBuilder arguments: ["%locale%"] @@ -14,20 +14,20 @@ sylius_grid: fields: media_file: type: twig - label: bitbag_sylius_cms_plugin.ui.preview + label: sylius_cms.ui.preview path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/image_preview.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/image_preview.html.twig" name: type: twig - label: bitbag_sylius_cms_plugin.ui.name + label: sylius_cms.ui.name sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/name.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ enabled: type: twig @@ -36,16 +36,16 @@ sylius_grid: template: "@SyliusUi/Grid/Field/enabled.html.twig" collections: type: twig - label: bitbag_sylius_cms_plugin.ui.collections + label: sylius_cms.ui.collections path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" channels: type: twig - label: bitbag_sylius_cms_plugin.ui.channels + label: sylius_cms.ui.channels path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string @@ -57,9 +57,9 @@ sylius_grid: label: sylius.ui.type form_options: choices: - sylius.ui.image: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::IMAGE_TYPE - bitbag_sylius_cms_plugin.ui.file: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::FILE_TYPE - bitbag_sylius_cms_plugin.ui.video: !php/const BitBag\SyliusCmsPlugin\Entity\MediaInterface::VIDEO_TYPE + sylius.ui.image: !php/const Sylius\CmsPlugin\Entity\MediaInterface::IMAGE_TYPE + sylius_cms.ui.file: !php/const Sylius\CmsPlugin\Entity\MediaInterface::FILE_TYPE + sylius_cms.ui.video: !php/const Sylius\CmsPlugin\Entity\MediaInterface::VIDEO_TYPE actions: main: import: diff --git a/src/Resources/config/grids/admin/page.yml b/src/Resources/config/grids/admin/page.yml index 4db7d1c64..fd37aa1ef 100755 --- a/src/Resources/config/grids/admin/page.yml +++ b/src/Resources/config/grids/admin/page.yml @@ -1,24 +1,24 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_page: + sylius_cms_admin_page: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.page.class%" + class: "%sylius_cms.model.page.class%" sorting: code: asc limits: [10, 25, 50] fields: name: type: twig - label: bitbag_sylius_cms_plugin.ui.name + label: sylius_cms.ui.name sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/name.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" code: type: string - label: bitbag_sylius_cms_plugin.ui.code + label: sylius_cms.ui.code sortable: ~ enabled: type: twig @@ -27,16 +27,16 @@ sylius_grid: template: "@SyliusUi/Grid/Field/enabled.html.twig" collections: type: twig - label: bitbag_sylius_cms_plugin.ui.collections + label: sylius_cms.ui.collections path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/collections.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/collections.html.twig" channels: type: twig - label: bitbag_sylius_cms_plugin.ui.channels + label: sylius_cms.ui.channels path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/channels.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/channels.html.twig" filters: search: type: string @@ -45,9 +45,9 @@ sylius_grid: fields: [code] collections: type: entity - label: bitbag_sylius_cms_plugin.ui.collections + label: sylius_cms.ui.collections form_options: - class: "%bitbag_sylius_cms_plugin.model.collection.class%" + class: "%sylius_cms.model.collection.class%" choice_label: name choice_value: code options: diff --git a/src/Resources/config/grids/admin/template.yml b/src/Resources/config/grids/admin/template.yml index bb3ae8490..1f82cae0f 100755 --- a/src/Resources/config/grids/admin/template.yml +++ b/src/Resources/config/grids/admin/template.yml @@ -1,21 +1,21 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_admin_template: + sylius_cms_admin_template: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.template.class%" + class: "%sylius_cms.model.template.class%" sorting: name: asc limits: [10, 25, 50] fields: name: type: twig - label: bitbag_sylius_cms_plugin.ui.name + label: sylius_cms.ui.name sortable: name path: . options: - template: "@BitBagSyliusCmsPlugin/Grid/Field/name.html.twig" + template: "@SyliusCmsPlugin/Grid/Field/name.html.twig" type: type: string label: sylius.ui.type diff --git a/src/Resources/config/grids/shop.yml b/src/Resources/config/grids/shop.yml index 0c4485e93..e01ab3a15 100755 --- a/src/Resources/config/grids/shop.yml +++ b/src/Resources/config/grids/shop.yml @@ -1,2 +1,2 @@ imports: - - { resource: "@BitBagSyliusCmsPlugin/Resources/config/grids/shop/page.yml" } + - { resource: "@SyliusCmsPlugin/Resources/config/grids/shop/page.yml" } diff --git a/src/Resources/config/grids/shop/page.yml b/src/Resources/config/grids/shop/page.yml index 664414b1f..5bfd0d705 100755 --- a/src/Resources/config/grids/shop/page.yml +++ b/src/Resources/config/grids/shop/page.yml @@ -1,10 +1,10 @@ sylius_grid: grids: - bitbag_sylius_cms_plugin_shop_page: + sylius_cms_shop_page: driver: name: doctrine/orm options: - class: "%bitbag_sylius_cms_plugin.model.page.class%" + class: "%sylius_cms.model.page.class%" repository: method: createShopListQueryBuilder arguments: diff --git a/src/Resources/config/resources.yml b/src/Resources/config/resources.yml deleted file mode 100755 index d6a5d3e5e..000000000 --- a/src/Resources/config/resources.yml +++ /dev/null @@ -1,7 +0,0 @@ -imports: - - { resource: resources/block.yml } - - { resource: resources/content_configuration.yml } - - { resource: resources/page.yml } - - { resource: resources/collection.yml } - - { resource: resources/media.yml } - - { resource: resources/template.yml } diff --git a/src/Resources/config/resources/block.yml b/src/Resources/config/resources/block.yml deleted file mode 100755 index 131137059..000000000 --- a/src/Resources/config/resources/block.yml +++ /dev/null @@ -1,11 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.block: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Block - interface: BitBag\SyliusCmsPlugin\Entity\BlockInterface - form: BitBag\SyliusCmsPlugin\Form\Type\BlockType - repository: BitBag\SyliusCmsPlugin\Repository\BlockRepository - controller: BitBag\SyliusCmsPlugin\Controller\BlockController - factory: Sylius\Component\Resource\Factory\Factory diff --git a/src/Resources/config/resources/collection.yml b/src/Resources/config/resources/collection.yml deleted file mode 100755 index 5e9f43d3c..000000000 --- a/src/Resources/config/resources/collection.yml +++ /dev/null @@ -1,10 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.collection: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Collection - interface: BitBag\SyliusCmsPlugin\Entity\CollectionInterface - form: BitBag\SyliusCmsPlugin\Form\Type\CollectionType - repository: BitBag\SyliusCmsPlugin\Repository\CollectionRepository - factory: Sylius\Component\Resource\Factory\Factory diff --git a/src/Resources/config/resources/content_configuration.yml b/src/Resources/config/resources/content_configuration.yml deleted file mode 100644 index 881db0a3c..000000000 --- a/src/Resources/config/resources/content_configuration.yml +++ /dev/null @@ -1,10 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.content_configuration: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\ContentConfiguration - interface: BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface - form: BitBag\SyliusCmsPlugin\Form\Type\ContentConfigurationType - repository: BitBag\SyliusCmsPlugin\Repository\ContentConfigurationRepository - factory: Sylius\Component\Resource\Factory\TranslatableFactory diff --git a/src/Resources/config/resources/media.yml b/src/Resources/config/resources/media.yml deleted file mode 100644 index 2b183a478..000000000 --- a/src/Resources/config/resources/media.yml +++ /dev/null @@ -1,15 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.media: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Media - interface: BitBag\SyliusCmsPlugin\Entity\MediaInterface - form: BitBag\SyliusCmsPlugin\Form\Type\MediaType - repository: BitBag\SyliusCmsPlugin\Repository\MediaRepository - controller: BitBag\SyliusCmsPlugin\Controller\MediaController - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\MediaTranslation - interface: BitBag\SyliusCmsPlugin\Entity\MediaTranslationInterface diff --git a/src/Resources/config/resources/page.yml b/src/Resources/config/resources/page.yml deleted file mode 100755 index 3f4dbc20f..000000000 --- a/src/Resources/config/resources/page.yml +++ /dev/null @@ -1,15 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.page: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Page - interface: BitBag\SyliusCmsPlugin\Entity\PageInterface - form: BitBag\SyliusCmsPlugin\Form\Type\PageType - repository: BitBag\SyliusCmsPlugin\Repository\PageRepository - controller: BitBag\SyliusCmsPlugin\Controller\PageController - factory: Sylius\Component\Resource\Factory\TranslatableFactory - translation: - classes: - model: BitBag\SyliusCmsPlugin\Entity\PageTranslation - interface: BitBag\SyliusCmsPlugin\Entity\PageTranslationInterface diff --git a/src/Resources/config/resources/template.yml b/src/Resources/config/resources/template.yml deleted file mode 100755 index cc68b045f..000000000 --- a/src/Resources/config/resources/template.yml +++ /dev/null @@ -1,11 +0,0 @@ -sylius_resource: - resources: - bitbag_sylius_cms_plugin.template: - driver: doctrine/orm - classes: - model: BitBag\SyliusCmsPlugin\Entity\Template - interface: BitBag\SyliusCmsPlugin\Entity\TemplateInterface - form: BitBag\SyliusCmsPlugin\Form\Type\TemplateType - repository: BitBag\SyliusCmsPlugin\Repository\TemplateRepository - factory: Sylius\Component\Resource\Factory\Factory - controller: BitBag\SyliusCmsPlugin\Controller\TemplateController diff --git a/src/Resources/config/routing.yml b/src/Resources/config/routing.yml index d27bd1a9b..9c784f82e 100755 --- a/src/Resources/config/routing.yml +++ b/src/Resources/config/routing.yml @@ -1,7 +1,7 @@ -bitbag_sylius_cms_plugin_admin: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin.yml" +sylius_cms_admin: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin.yml" prefix: '/%sylius_admin.path_name%' -bitbag_sylius_cms_plugin_shop: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop.yml" +sylius_cms_shop: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop.yml" prefix: /{_locale} diff --git a/src/Resources/config/routing/admin.yml b/src/Resources/config/routing/admin.yml index 126f90a95..693e1199e 100755 --- a/src/Resources/config/routing/admin.yml +++ b/src/Resources/config/routing/admin.yml @@ -1,46 +1,46 @@ -bitbag_sylius_cms_plugin_admin_block: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/block.yml" +sylius_cms_admin_block: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/block.yml" -bitbag_sylius_cms_plugin_admin_page: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/page.yml" +sylius_cms_admin_page: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/page.yml" -bitbag_sylius_cms_plugin_admin_collection: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/collection.yml" +sylius_cms_admin_collection: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/collection.yml" -bitbag_sylius_cms_plugin_admin_media: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/media.yml" +sylius_cms_admin_media: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/media.yml" -bitbag_sylius_cms_plugin_admin_product: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/product.yml" +sylius_cms_admin_product: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/product.yml" -bitbag_sylius_cms_plugin_admin_taxon: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/taxon.yml" +sylius_cms_admin_taxon: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/taxon.yml" -bitbag_sylius_cms_plugin_admin_locale: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/locale.yml" +sylius_cms_admin_locale: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/locale.yml" -bitbag_sylius_cms_plugin_admin_template: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/admin/template.yml" +sylius_cms_admin_template: + resource: "@SyliusCmsPlugin/Resources/config/routing/admin/template.yml" -bitbag_sylius_cms_plugin_admin_ajax_generate_page_slug: +sylius_cms_admin_ajax_generate_page_slug: path: /page/generate-slug methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page_slug::generateAction + _controller: sylius_cms.controller.page_slug::generateAction -bitbag_sylius_cms_plugin_admin_import_data: +sylius_cms_admin_import_data: path: /import/{resourceName} methods: [GET, POST] defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.import_data + _controller: sylius_cms.controller.action.admin.import_data -bitbag_sylius_cms_plugin_admin_upload_editor_image: +sylius_cms_admin_upload_editor_image: path: /editor/upload-image defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.upload_editor_image + _controller: sylius_cms.controller.action.admin.upload_editor_image -bitbag_sylius_cms_plugin_admin_retrieve_package_info: +sylius_cms_admin_retrieve_package_info: path: /cms/retrieve-package-info methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.action.admin.retrieve_package_info + _controller: sylius_cms.controller.action.admin.retrieve_package_info diff --git a/src/Resources/config/routing/admin/block.yml b/src/Resources/config/routing/admin/block.yml index 5025d02b7..d5b27c175 100755 --- a/src/Resources/config/routing/admin/block.yml +++ b/src/Resources/config/routing/admin/block.yml @@ -1,18 +1,18 @@ -bitbag_sylius_cms_plugin_admin_block: +sylius_cms_admin_block: resource: | - alias: bitbag_sylius_cms_plugin.block + alias: sylius_cms.block section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' except: ['show'] redirect: update - grid: bitbag_sylius_cms_plugin_admin_block + grid: sylius_cms_admin_block permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.blocks_header - subheader: bitbag_sylius_cms_plugin.ui.blocks_subheader + header: sylius_cms.ui.blocks_header + subheader: sylius_cms.ui.blocks_subheader templates: - form: "@BitBagSyliusCmsPlugin/Block/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Block/Crud/_form.html.twig" index: icon: block layout route: @@ -20,20 +20,20 @@ bitbag_sylius_cms_plugin_admin_block: code: $type type: sylius.resource -bitbag_sylius_cms_plugin_admin_block_preview: +sylius_cms_admin_block_preview: path: /block/preview methods: [GET, POST, PUT] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::previewAction + _controller: sylius_cms.controller.block::previewAction _sylius: - template: "@BitBagSyliusCmsPlugin/Block/preview.html.twig" + template: "@SyliusCmsPlugin/Block/preview.html.twig" -bitbag_sylius_cms_plugin_admin_ajax_block_by_name_phrase: +sylius_cms_admin_ajax_block_by_name_phrase: path: /ajax/blocks/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.block::indexAction + _controller: sylius_cms.controller.block::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -42,12 +42,12 @@ bitbag_sylius_cms_plugin_admin_ajax_block_by_name_phrase: arguments: phrase: $phrase -bitbag_sylius_cms_plugin_admin_ajax_block_by_code: +sylius_cms_admin_ajax_block_by_code: path: /ajax/blocks/code methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.block::indexAction + _controller: sylius_cms.controller.block::indexAction _sylius: serialization_groups: [Autocomplete] permission: true diff --git a/src/Resources/config/routing/admin/collection.yml b/src/Resources/config/routing/admin/collection.yml index ad8b95fd9..cca2c9984 100755 --- a/src/Resources/config/routing/admin/collection.yml +++ b/src/Resources/config/routing/admin/collection.yml @@ -1,28 +1,28 @@ -bitbag_sylius_cms_plugin_admin_collection: +sylius_cms_admin_collection: resource: | - alias: bitbag_sylius_cms_plugin.collection + alias: sylius_cms.collection section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' redirect: update - grid: bitbag_sylius_cms_plugin_admin_collection + grid: sylius_cms_admin_collection except: ['show'] permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.collections_header - subheader: bitbag_sylius_cms_plugin.ui.collections_subheader + header: sylius_cms.ui.collections_header + subheader: sylius_cms.ui.collections_subheader templates: - form: "@BitBagSyliusCmsPlugin/Collection/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Collection/Crud/_form.html.twig" index: icon: grid layout type: sylius.resource -bitbag_sylius_cms_plugin_admin_ajax_collection_by_name_phrase: +sylius_cms_admin_ajax_collection_by_name_phrase: path: /ajax/collections/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.collection::indexAction + _controller: sylius_cms.controller.collection::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -31,12 +31,12 @@ bitbag_sylius_cms_plugin_admin_ajax_collection_by_name_phrase: arguments: phrase: $phrase -bitbag_sylius_cms_plugin_admin_ajax_page_collection_by_name_phrase: +sylius_cms_admin_ajax_page_collection_by_name_phrase: path: /ajax/collections/page/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.collection::indexAction + _controller: sylius_cms.controller.collection::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -46,12 +46,12 @@ bitbag_sylius_cms_plugin_admin_ajax_page_collection_by_name_phrase: phrase: $phrase type: page -bitbag_sylius_cms_plugin_admin_ajax_collection_by_code: +sylius_cms_admin_ajax_collection_by_code: path: /ajax/collections/code methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.collection::indexAction + _controller: sylius_cms.controller.collection::indexAction _sylius: serialization_groups: [Autocomplete] permission: true diff --git a/src/Resources/config/routing/admin/locale.yml b/src/Resources/config/routing/admin/locale.yml index 9b398a5de..3a4e3fa6c 100644 --- a/src/Resources/config/routing/admin/locale.yml +++ b/src/Resources/config/routing/admin/locale.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin_admin_partial_locale_index: +sylius_cms_admin_partial_locale_index: path: /_partial/locales methods: [GET] defaults: diff --git a/src/Resources/config/routing/admin/media.yml b/src/Resources/config/routing/admin/media.yml index 726ef12c4..2a799aec3 100644 --- a/src/Resources/config/routing/admin/media.yml +++ b/src/Resources/config/routing/admin/media.yml @@ -1,28 +1,28 @@ -bitbag_sylius_cms_plugin_admin_media: +sylius_cms_admin_media: resource: | - alias: bitbag_sylius_cms_plugin.media + alias: sylius_cms.media section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' redirect: update - grid: bitbag_sylius_cms_plugin_admin_media + grid: sylius_cms_admin_media except: ['show'] permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.media_header - subheader: bitbag_sylius_cms_plugin.ui.media_subheader + header: sylius_cms.ui.media_header + subheader: sylius_cms.ui.media_subheader templates: - form: "@BitBagSyliusCmsPlugin/Media/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Media/Crud/_form.html.twig" index: icon: file type: sylius.resource -bitbag_sylius_cms_plugin_admin_ajax_media_by_name_phrase: +sylius_cms_admin_ajax_media_by_name_phrase: path: /ajax/media/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction + _controller: sylius_cms.controller.media.overriden::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -32,12 +32,12 @@ bitbag_sylius_cms_plugin_admin_ajax_media_by_name_phrase: phrase: $phrase mediaType: $mediaType -bitbag_sylius_cms_plugin_admin_ajax_media_by_code: +sylius_cms_admin_ajax_media_by_code: path: /ajax/media/code methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::indexAction + _controller: sylius_cms.controller.media.overriden::indexAction _sylius: serialization_groups: [Autocomplete] permission: true diff --git a/src/Resources/config/routing/admin/page.yml b/src/Resources/config/routing/admin/page.yml index b5219d1d1..8f9200f98 100755 --- a/src/Resources/config/routing/admin/page.yml +++ b/src/Resources/config/routing/admin/page.yml @@ -1,37 +1,37 @@ -bitbag_sylius_cms_plugin_admin_page: +sylius_cms_admin_page: resource: | - alias: bitbag_sylius_cms_plugin.page + alias: sylius_cms.page section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' redirect: update - grid: bitbag_sylius_cms_plugin_admin_page + grid: sylius_cms_admin_page except: ['show'] permission: true vars: all: - header: bitbag_sylius_cms_plugin.ui.pages_header - subheader: bitbag_sylius_cms_plugin.ui.pages_subheader + header: sylius_cms.ui.pages_header + subheader: sylius_cms.ui.pages_subheader templates: - form: "@BitBagSyliusCmsPlugin/Page/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Page/Crud/_form.html.twig" index: icon: sticky note type: sylius.resource -bitbag_sylius_cms_plugin_admin_page_preview: +sylius_cms_admin_page_preview: path: /page/preview/{id} methods: [GET, POST, PUT] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::previewAction + _controller: sylius_cms.controller.page.overriden::previewAction _sylius: - template: "@BitBagSyliusCmsPlugin/Page/preview.html.twig" + template: "@SyliusCmsPlugin/Page/preview.html.twig" id: null -bitbag_sylius_cms_plugin_admin_ajax_page_by_name_phrase: +sylius_cms_admin_ajax_page_by_name_phrase: path: /ajax/pages/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.page::indexAction + _controller: sylius_cms.controller.page::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -40,12 +40,12 @@ bitbag_sylius_cms_plugin_admin_ajax_page_by_name_phrase: arguments: phrase: $phrase -bitbag_sylius_cms_plugin_admin_ajax_page_by_code: +sylius_cms_admin_ajax_page_by_code: path: /ajax/pages/code methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.page::indexAction + _controller: sylius_cms.controller.page::indexAction _sylius: serialization_groups: [Autocomplete] permission: true diff --git a/src/Resources/config/routing/admin/product.yml b/src/Resources/config/routing/admin/product.yml index ef296f342..0e0168796 100644 --- a/src/Resources/config/routing/admin/product.yml +++ b/src/Resources/config/routing/admin/product.yml @@ -1,6 +1,6 @@ -bitbag_sylius_cms_plugin_admin_ajax_product_by_name_phrase: +sylius_cms_admin_ajax_product_by_name_phrase: path: /ajax/products/search-by-name methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.action.admin.product_search + _controller: sylius_cms.controller.action.admin.product_search diff --git a/src/Resources/config/routing/admin/taxon.yml b/src/Resources/config/routing/admin/taxon.yml index 9a26281ee..fa191797b 100644 --- a/src/Resources/config/routing/admin/taxon.yml +++ b/src/Resources/config/routing/admin/taxon.yml @@ -1,6 +1,6 @@ -bitbag_sylius_cms_plugin_admin_ajax_taxon_by_name_phrase: +sylius_cms_admin_ajax_taxon_by_name_phrase: path: /ajax/taxon/search-by-name methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.action.admin.taxon_search + _controller: sylius_cms.controller.action.admin.taxon_search diff --git a/src/Resources/config/routing/admin/template.yml b/src/Resources/config/routing/admin/template.yml index 9013de97b..33d2d8ad1 100755 --- a/src/Resources/config/routing/admin/template.yml +++ b/src/Resources/config/routing/admin/template.yml @@ -1,26 +1,26 @@ -bitbag_sylius_cms_plugin_admin_template: +sylius_cms_admin_template: resource: | - alias: bitbag_sylius_cms_plugin.template + alias: sylius_cms.template section: admin - templates: '@BitBagSyliusCmsPlugin/CrudUi' + templates: '@SyliusCmsPlugin/CrudUi' except: ['show'] redirect: update - grid: bitbag_sylius_cms_plugin_admin_template + grid: sylius_cms_admin_template permission: true vars: all: templates: - form: "@BitBagSyliusCmsPlugin/Template/Crud/_form.html.twig" + form: "@SyliusCmsPlugin/Template/Crud/_form.html.twig" index: icon: block layout type: sylius.resource -bitbag_sylius_cms_plugin_admin_ajax_template_page_by_name_phrase: +sylius_cms_admin_ajax_template_page_by_name_phrase: path: /ajax/templates/page/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.template::indexAction + _controller: sylius_cms.controller.template::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -30,12 +30,12 @@ bitbag_sylius_cms_plugin_admin_ajax_template_page_by_name_phrase: phrase: $phrase type: page -bitbag_sylius_cms_plugin_admin_ajax_template_block_by_name_phrase: +sylius_cms_admin_ajax_template_block_by_name_phrase: path: /ajax/templates/block/search methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.template::indexAction + _controller: sylius_cms.controller.template::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -45,12 +45,12 @@ bitbag_sylius_cms_plugin_admin_ajax_template_block_by_name_phrase: phrase: $phrase type: block -bitbag_sylius_cms_plugin_admin_ajax_template_by_id: +sylius_cms_admin_ajax_template_by_id: path: /ajax/templates/id methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.template::indexAction + _controller: sylius_cms.controller.template::indexAction _sylius: serialization_groups: [Autocomplete] permission: true @@ -58,11 +58,11 @@ bitbag_sylius_cms_plugin_admin_ajax_template_by_id: method: find arguments: [id: $id] -bitbag_sylius_cms_plugin_admin_ajax_template_content_by_id: +sylius_cms_admin_ajax_template_content_by_id: path: /ajax/templates/content/{id} methods: [GET] defaults: _format: json - _controller: bitbag_sylius_cms_plugin.controller.template::getContentElementsAction + _controller: sylius_cms.controller.action.admin.template_content_elements::getContentElementsAction _sylius: permission: true diff --git a/src/Resources/config/routing/shop.yml b/src/Resources/config/routing/shop.yml index 14ad3e9c5..bd3c5283f 100755 --- a/src/Resources/config/routing/shop.yml +++ b/src/Resources/config/routing/shop.yml @@ -1,11 +1,11 @@ -bitbag_sylius_cms_plugin_shop_block: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/block.yml" +sylius_cms_shop_block: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/block.yml" -bitbag_sylius_cms_plugin_shop_page: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/page.yml" +sylius_cms_shop_page: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/page.yml" -bitbag_sylius_cms_plugin_shop_collection: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/collection.yml" +sylius_cms_shop_collection: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/collection.yml" -bitbag_sylius_cms_plugin_shop_media: - resource: "@BitBagSyliusCmsPlugin/Resources/config/routing/shop/media.yml" +sylius_cms_shop_media: + resource: "@SyliusCmsPlugin/Resources/config/routing/shop/media.yml" diff --git a/src/Resources/config/routing/shop/block.yml b/src/Resources/config/routing/shop/block.yml index 79eb47675..e639af5fe 100755 --- a/src/Resources/config/routing/shop/block.yml +++ b/src/Resources/config/routing/shop/block.yml @@ -1,19 +1,19 @@ -bitbag_sylius_cms_plugin_shop_block_render: +sylius_cms_shop_block_render: path: /block/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::renderBlockAction + _controller: sylius_cms.controller.block::renderBlockAction _sylius: repository: method: findOneByCode arguments: - $code -bitbag_sylius_cms_plugin_shop_block_index_by_collection_code: +sylius_cms_shop_block_index_by_collection_code: path: /blocks/collection/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.block::indexAction + _controller: sylius_cms.controller.block::indexAction _sylius: template: $template repository: diff --git a/src/Resources/config/routing/shop/collection.yml b/src/Resources/config/routing/shop/collection.yml index 051ea55cb..0c045b479 100755 --- a/src/Resources/config/routing/shop/collection.yml +++ b/src/Resources/config/routing/shop/collection.yml @@ -1,8 +1,8 @@ -bitbag_sylius_cms_plugin_shop_collection_show: +sylius_cms_shop_collection_show: path: /collection/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.collection::showAction + _controller: sylius_cms.controller.collection::showAction _sylius: template: $template repository: @@ -10,11 +10,11 @@ bitbag_sylius_cms_plugin_shop_collection_show: arguments: - $code -bitbag_sylius_cms_plugin_shop_collection_show_codes: +sylius_cms_shop_collection_show_codes: path: /collections/{codes} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.collection::indexAction + _controller: sylius_cms.controller.collection::indexAction _sylius: template: $template repository: diff --git a/src/Resources/config/routing/shop/media.yml b/src/Resources/config/routing/shop/media.yml index 36826fb59..6f1791f32 100755 --- a/src/Resources/config/routing/shop/media.yml +++ b/src/Resources/config/routing/shop/media.yml @@ -1,19 +1,19 @@ -bitbag_sylius_cms_plugin_shop_media_render: +sylius_cms_shop_media_render: path: /media/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::renderMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::renderMediaAction -bitbag_sylius_cms_plugin_shop_media_download: +sylius_cms_shop_media_download: path: /media/download/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::downloadMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::downloadMediaAction disposition: !php/const Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_ATTACHMENT -bitbag_sylius_cms_plugin_shop_media_inline: +sylius_cms_shop_media_inline: path: /media/inline/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.media.overriden::downloadMediaAction + _controller: sylius_cms_plugin.controller.media.overriden::downloadMediaAction disposition: !php/const Symfony\Component\HttpFoundation\ResponseHeaderBag::DISPOSITION_INLINE diff --git a/src/Resources/config/routing/shop/page.yml b/src/Resources/config/routing/shop/page.yml index 5162c6be1..9d8f2d928 100755 --- a/src/Resources/config/routing/shop/page.yml +++ b/src/Resources/config/routing/shop/page.yml @@ -1,10 +1,10 @@ -bitbag_sylius_cms_plugin_shop_page_show: +sylius_cms_shop_page_show: path: /page/{slug} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::showAction + _controller: sylius_cms.controller.page.overriden::showAction _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/show.html.twig" + template: "@SyliusCmsPlugin/Shop/Page/show.html.twig" repository: method: findOneEnabledBySlugAndChannelCode arguments: @@ -12,11 +12,11 @@ bitbag_sylius_cms_plugin_shop_page_show: - "expr:service('sylius.context.locale').getLocaleCode()" - "expr:service('sylius.context.channel').getChannel().getCode()" -bitbag_sylius_cms_plugin_shop_page_show_link_by_code: +sylius_cms_shop_page_show_link_by_code: path: /page/link/{code} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::renderLinkAction + _controller: sylius_cms.controller.page.overriden::renderLinkAction _sylius: template: $template repository: @@ -24,39 +24,39 @@ bitbag_sylius_cms_plugin_shop_page_show_link_by_code: arguments: - $code -bitbag_sylius_cms_plugin_shop_page_index_by_collection_code: +sylius_cms_shop_page_index_by_collection_code: path: /page/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/index.html.twig" - grid: bitbag_sylius_cms_plugin_shop_page + template: "@SyliusCmsPlugin/Shop/Page/index.html.twig" + grid: sylius_cms_shop_page repository: method: findByCollectionCode arguments: - $collectionCode -bitbag_sylius_cms_plugin_shop_page_index_by_collection_code_no_grid: +sylius_cms_shop_page_index_by_collection_code_no_grid: path: /pages/{collectionCode}/no-grid methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: - template: "@BitBagSyliusCmsPlugin/Shop/Page/index.html.twig" + template: "@SyliusCmsPlugin/Shop/Page/index.html.twig" repository: method: findByCollectionCode arguments: - $collectionCode -bitbag_sylius_cms_plugin_shop_page_index_by_collection_code_template: +sylius_cms_shop_page_index_by_collection_code_template: path: /pages-template/{collectionCode} methods: [GET] defaults: - _controller: bitbag_sylius_cms_plugin.controller.page.overriden::indexAction + _controller: sylius_cms.controller.page.overriden::indexAction _sylius: template: $template - grid: bitbag_sylius_cms_plugin_shop_page + grid: sylius_cms_shop_page repository: method: findByCollectionCode arguments: diff --git a/src/Resources/config/serialization/Block.xml b/src/Resources/config/serialization/Block.xml index 6bcab96ea..c0648ecd9 100644 --- a/src/Resources/config/serialization/Block.xml +++ b/src/Resources/config/serialization/Block.xml @@ -3,33 +3,40 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:block:read:index + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:index + sylius_cms:block:read:show - - shop:cms:read + + sylius_cms:block:read:index + sylius_cms:block:read:show - - shop:cms:read + + sylius_cms:block:read:index + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:show + + + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:show - shop:cms:read + sylius_cms:block:read:show diff --git a/src/Resources/config/serialization/Collection.xml b/src/Resources/config/serialization/Collection.xml index 6f11af78c..90182810b 100644 --- a/src/Resources/config/serialization/Collection.xml +++ b/src/Resources/config/serialization/Collection.xml @@ -3,12 +3,27 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:collection:read:index + sylius_cms:collection:read:show - shop:cms:read + sylius_cms:collection:read:index + sylius_cms:collection:read:show + + + sylius_cms:collection:read:index + sylius_cms:collection:read:show + + + sylius_cms:collection:read:show + + + sylius_cms:collection:read:show + + + sylius_cms:collection:read:show diff --git a/src/Resources/config/serialization/Media.xml b/src/Resources/config/serialization/Media.xml index 451a4f154..24f4c722b 100644 --- a/src/Resources/config/serialization/Media.xml +++ b/src/Resources/config/serialization/Media.xml @@ -3,45 +3,50 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:media:read:index + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:index + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:index + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:index + sylius_cms:media:read:show + + + sylius_cms:media:read:index + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read - - - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show diff --git a/src/Resources/config/serialization/MediaTranslation.xml b/src/Resources/config/serialization/MediaTranslation.xml index 627f01e71..1a773bbb0 100644 --- a/src/Resources/config/serialization/MediaTranslation.xml +++ b/src/Resources/config/serialization/MediaTranslation.xml @@ -3,15 +3,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show - shop:cms:read + sylius_cms:media:read:show diff --git a/src/Resources/config/serialization/Page.xml b/src/Resources/config/serialization/Page.xml index 250782121..50a05b5d2 100644 --- a/src/Resources/config/serialization/Page.xml +++ b/src/Resources/config/serialization/Page.xml @@ -3,21 +3,27 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:page:read:index + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:index + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:index + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:show + + + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:show diff --git a/src/Resources/config/serialization/PageTranslation.xml b/src/Resources/config/serialization/PageTranslation.xml index 9be02fc90..8d759d46b 100644 --- a/src/Resources/config/serialization/PageTranslation.xml +++ b/src/Resources/config/serialization/PageTranslation.xml @@ -3,21 +3,18 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - - - shop:cms:read - + - shop:cms:read + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:show - shop:cms:read + sylius_cms:page:read:show diff --git a/src/Resources/config/serialization/Template.xml b/src/Resources/config/serialization/Template.xml index e65ab80fc..666114643 100644 --- a/src/Resources/config/serialization/Template.xml +++ b/src/Resources/config/serialization/Template.xml @@ -3,18 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd" > - + - shop:cms:read + sylius_cms:template:read:index + sylius_cms:template:read:show - shop:cms:read + sylius_cms:template:read:index + sylius_cms:template:read:show - shop:cms:read + sylius_cms:template:read:index + sylius_cms:template:read:show - shop:cms:read + sylius_cms:template:read:show diff --git a/src/Resources/config/serializer/Entity.Block.yml b/src/Resources/config/serializer/Entity.Block.yml index 785a05373..80781986c 100644 --- a/src/Resources/config/serializer/Entity.Block.yml +++ b/src/Resources/config/serializer/Entity.Block.yml @@ -1,4 +1,4 @@ -BitBag\SyliusCmsPlugin\Entity\Block: +Sylius\CmsPlugin\Entity\Block: exclusion_policy: ALL xml_root_name: block properties: diff --git a/src/Resources/config/serializer/Entity.Collection.yml b/src/Resources/config/serializer/Entity.Collection.yml index b98b6ee9a..ff18f5d99 100644 --- a/src/Resources/config/serializer/Entity.Collection.yml +++ b/src/Resources/config/serializer/Entity.Collection.yml @@ -1,4 +1,4 @@ -BitBag\SyliusCmsPlugin\Entity\Collection: +Sylius\CmsPlugin\Entity\Collection: exclusion_policy: ALL xml_root_name: collection properties: diff --git a/src/Resources/config/serializer/Entity.Media.yml b/src/Resources/config/serializer/Entity.Media.yml index 8cf3defd2..d6c46c77f 100644 --- a/src/Resources/config/serializer/Entity.Media.yml +++ b/src/Resources/config/serializer/Entity.Media.yml @@ -1,4 +1,4 @@ -BitBag\SyliusCmsPlugin\Entity\Media: +Sylius\CmsPlugin\Entity\Media: exclusion_policy: ALL xml_root_name: media properties: @@ -19,7 +19,7 @@ BitBag\SyliusCmsPlugin\Entity\Media: - rel: self href: - route: bitbag_sylius_cms_plugin_shop_media_inline + route: sylius_cms_shop_media_inline parameters: _locale: expr(object.getTranslation().getLocale()) code: expr(object.getCode()) diff --git a/src/Resources/config/serializer/Entity.Page.yml b/src/Resources/config/serializer/Entity.Page.yml index 2bda04f44..75367e63a 100644 --- a/src/Resources/config/serializer/Entity.Page.yml +++ b/src/Resources/config/serializer/Entity.Page.yml @@ -1,4 +1,4 @@ -BitBag\SyliusCmsPlugin\Entity\Page: +Sylius\CmsPlugin\Entity\Page: exclusion_policy: ALL xml_root_name: page properties: diff --git a/src/Resources/config/serializer/Entity.Template.yml b/src/Resources/config/serializer/Entity.Template.yml index dced067d2..7e19eefb3 100644 --- a/src/Resources/config/serializer/Entity.Template.yml +++ b/src/Resources/config/serializer/Entity.Template.yml @@ -1,4 +1,4 @@ -BitBag\SyliusCmsPlugin\Entity\Template: +Sylius\CmsPlugin\Entity\Template: exclusion_policy: ALL xml_root_name: template properties: diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 25bcef1cb..90fe0ae3a 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -6,42 +6,38 @@ - BitBag\SyliusCmsPlugin\MediaProvider\ProviderInterface + Sylius\CmsPlugin\MediaProvider\ProviderInterface - + - - - + + + - - + + - - - - - - %bitbag_sylius_cms_plugin.media_provider.interface% + + %sylius_cms.media_provider.interface% Media provider - - + + - + - %bitbag_sylius_cms_plugin.uploader.filesystem% + %sylius_cms.uploader.filesystem% - + diff --git a/src/Resources/config/services/assigner.xml b/src/Resources/config/services/assigner.xml index 3928794e4..585268f25 100644 --- a/src/Resources/config/services/assigner.xml +++ b/src/Resources/config/services/assigner.xml @@ -4,27 +4,27 @@ - + - + - + - - + + - + - + diff --git a/src/Resources/config/services/controller.xml b/src/Resources/config/services/controller.xml index 9f40680ed..bbd1d4003 100644 --- a/src/Resources/config/services/controller.xml +++ b/src/Resources/config/services/controller.xml @@ -4,51 +4,55 @@ - + - + - + - - + + - + - - - - + + + + - + + + + + - + - + - + - + @@ -58,12 +62,12 @@ - + - + - + @@ -73,6 +77,6 @@ - + diff --git a/src/Resources/config/services/event_listener.xml b/src/Resources/config/services/event_listener.xml index 95d29208e..5df6289b1 100644 --- a/src/Resources/config/services/event_listener.xml +++ b/src/Resources/config/services/event_listener.xml @@ -4,18 +4,18 @@ - - + + - - - - + + + + - + diff --git a/src/Resources/config/services/fixture.xml b/src/Resources/config/services/fixture.xml index e1f57e487..6258eceb5 100644 --- a/src/Resources/config/services/fixture.xml +++ b/src/Resources/config/services/fixture.xml @@ -4,69 +4,68 @@ - - + + - - + + - - + + - - + + - - + + - - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + diff --git a/src/Resources/config/services/form.xml b/src/Resources/config/services/form.xml index 799016e55..1d517afc2 100644 --- a/src/Resources/config/services/form.xml +++ b/src/Resources/config/services/form.xml @@ -2,162 +2,122 @@ - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\TextareaContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\SingleMediaContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\MultipleMediaContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\HeadingContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsCarouselContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsCarouselByTaxonContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsGridContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsGridByTaxonContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\TaxonsListContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\PagesCollectionContentElementType::TYPE - BitBag\SyliusCmsPlugin\Form\Type\ContentElements\SpacerContentElementType::TYPE + Sylius\CmsPlugin\Form\Type\ContentElements\SingleMediaContentElementType::TYPE + Sylius\CmsPlugin\Form\Type\ContentElements\MultipleMediaContentElementType::TYPE + Sylius\CmsPlugin\Form\Type\ContentElements\ProductsCarouselByTaxonContentElementType::TYPE + Sylius\CmsPlugin\Form\Type\ContentElements\ProductsGridByTaxonContentElementType::TYPE + Sylius\CmsPlugin\Form\Type\ContentElements\PagesCollectionContentElementType::TYPE - - %bitbag_sylius_cms_plugin.model.block.class% - %bitbag_sylius_cms_plugin.form.type.block.validation_groups% + + + %sylius_cms.model.block.class% + %sylius_cms.form.type.block.validation_groups% - - BitBag\SyliusCmsPlugin\Entity\ContentConfiguration - %bitbag_sylius_cms_plugin.form.type.content_configuration.validation_groups% - + + Sylius\CmsPlugin\Entity\ContentConfiguration + %sylius_cms.form.type.content_configuration.validation_groups% + - - BitBag\SyliusCmsPlugin\Entity\BlockImage - %bitbag_sylius_cms_plugin.form.type.block_image.validation_groups% + + + %sylius_cms.model.page.class% + %sylius_cms.form.type.page.validation_groups% - - %bitbag_sylius_cms_plugin.model.page.class% - %bitbag_sylius_cms_plugin.form.type.page.validation_groups% + + %sylius_cms.model.page_translation.class% + %sylius_cms.form.type.translation.page.validation_groups% - - %bitbag_sylius_cms_plugin.model.page_translation.class% - %bitbag_sylius_cms_plugin.form.type.translation.page.validation_groups% + + %sylius_cms.model.collection.class% + %sylius_cms.form.type.collection.validation_groups% - - %bitbag_sylius_cms_plugin.model.collection.class% - %bitbag_sylius_cms_plugin.form.type.collection.validation_groups% + - + + %sylius_cms.model.media_translation.class% + %sylius_cms.form.type.translation.media.validation_groups% - - %bitbag_sylius_cms_plugin.model.media_translation.class% - %bitbag_sylius_cms_plugin.form.type.translation.media.validation_groups% + + %sylius_cms.model.media.class% + %sylius_cms.form.type.media.validation_groups% + %sylius_cms.media_providers% - - %bitbag_sylius_cms_plugin.model.media.class% - %bitbag_sylius_cms_plugin.form.type.media.validation_groups% - %bitbag_sylius_cms_plugin.media_providers% - - - - + - - %bitbag_sylius_cms_plugin.model.template.class% - %bitbag_sylius_cms_plugin.form.type.template.validation_groups% - - - - - + + %sylius_cms.model.template.class% + %sylius_cms.form.type.template.validation_groups% - - + + - - - - + + + + - - - + + + - - - - - - - - - - - + - - + + - - - - - - + - - - - - - - - - - - - - - + + - - + + + + - - + + - + diff --git a/src/Resources/config/services/importer.xml b/src/Resources/config/services/importer.xml index d5eb2c352..1ed179826 100644 --- a/src/Resources/config/services/importer.xml +++ b/src/Resources/config/services/importer.xml @@ -4,38 +4,58 @@ - + - - + + - - + + - + - - - - - - - - + + + + + + + - - + + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Resources/config/services/media_provider.xml b/src/Resources/config/services/media_provider.xml index 52f284517..989c30996 100644 --- a/src/Resources/config/services/media_provider.xml +++ b/src/Resources/config/services/media_provider.xml @@ -4,28 +4,28 @@ - - + + - @BitBagSyliusCmsPlugin/Shop/Media/Show/image.html.twig + @SyliusCmsPlugin/Shop/Media/Show/image.html.twig media/image - + - - + + - @BitBagSyliusCmsPlugin/Shop/Media/Show/video.html.twig + @SyliusCmsPlugin/Shop/Media/Show/video.html.twig media/video - + - - + + - @BitBagSyliusCmsPlugin/Shop/Media/Show/file.html.twig + @SyliusCmsPlugin/Shop/Media/Show/file.html.twig media/file - + diff --git a/src/Resources/config/services/menu.xml b/src/Resources/config/services/menu.xml index 549122526..0f78688e5 100644 --- a/src/Resources/config/services/menu.xml +++ b/src/Resources/config/services/menu.xml @@ -4,6 +4,6 @@ - + diff --git a/src/Resources/config/services/orm.xml b/src/Resources/config/services/orm.xml new file mode 100644 index 000000000..4c59b14ec --- /dev/null +++ b/src/Resources/config/services/orm.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/Resources/config/services/renderer.xml b/src/Resources/config/services/renderer.xml index 182ed4e54..7c17f5e6f 100644 --- a/src/Resources/config/services/renderer.xml +++ b/src/Resources/config/services/renderer.xml @@ -4,98 +4,127 @@ - - - + + + + - - - + + - - - - - + + + + - - - - - + + + + - - - + + - - + - + - - + - + - - + - + - - + - + - - + - + - - - - + + + - - - + + - - + + - - - + + + - - - + + + - - - + + + - + diff --git a/src/Resources/config/services/resolver.xml b/src/Resources/config/services/resolver.xml index 3c0b800a0..2aaf7d5b7 100644 --- a/src/Resources/config/services/resolver.xml +++ b/src/Resources/config/services/resolver.xml @@ -4,80 +4,78 @@ - - - + + + code - - - + + + code - - - + + + code - - - + + + code - - + + - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/src/Resources/config/services/twig.xml b/src/Resources/config/services/twig.xml index d831b84ca..ff0c2e71a 100644 --- a/src/Resources/config/services/twig.xml +++ b/src/Resources/config/services/twig.xml @@ -2,82 +2,91 @@ - - bitbag_cms_render_block - bitbag_cms_render_media + + sylius_cms_render_block + sylius_cms_render_media - @BitBagSyliusCmsPlugin/Page/link.html.twig + @SyliusCmsPlugin/Page/link.html.twig - - + + - - + + - + - - + + - + - - + + - - + + - - - + + + - + - - + + - + - - + + - + - %bitbag_cms.twig.admin_functions% + %sylius_cms.twig.admin_functions% - + - - + + - %bitbag_cms.twig.link_template% + %sylius_cms.twig.link_template% + + + + + + + + + diff --git a/src/Resources/config/validation/Block.xml b/src/Resources/config/validation/Block.xml index 272b1ee50..f142162c3 100644 --- a/src/Resources/config/validation/Block.xml +++ b/src/Resources/config/validation/Block.xml @@ -3,38 +3,38 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - + - - + + - + @@ -42,16 +42,16 @@ - - + + diff --git a/src/Resources/config/validation/Collection.xml b/src/Resources/config/validation/Collection.xml index bd2499bc0..4bdd82aff 100644 --- a/src/Resources/config/validation/Collection.xml +++ b/src/Resources/config/validation/Collection.xml @@ -3,56 +3,56 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - + - - + + - + - + - - + + diff --git a/src/Resources/config/validation/Media.xml b/src/Resources/config/validation/Media.xml index 9b1ebbfde..eb8ee1eba 100644 --- a/src/Resources/config/validation/Media.xml +++ b/src/Resources/config/validation/Media.xml @@ -3,46 +3,46 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - + - - + + - + - - + + - + @@ -50,16 +50,16 @@ - - + + @@ -67,9 +67,9 @@ - + @@ -77,7 +77,7 @@ diff --git a/src/Resources/config/validation/MediaTranslation.xml b/src/Resources/config/validation/MediaTranslation.xml index 7996a1d33..4897fd36e 100644 --- a/src/Resources/config/validation/MediaTranslation.xml +++ b/src/Resources/config/validation/MediaTranslation.xml @@ -3,15 +3,15 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - - + + @@ -20,10 +20,10 @@ - - + + @@ -31,10 +31,10 @@ - - + + diff --git a/src/Resources/config/validation/Page.xml b/src/Resources/config/validation/Page.xml index 2219b3f98..a663aecae 100644 --- a/src/Resources/config/validation/Page.xml +++ b/src/Resources/config/validation/Page.xml @@ -3,56 +3,56 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - + - - + + - + - + - - + + diff --git a/src/Resources/config/validation/PageTranslation.xml b/src/Resources/config/validation/PageTranslation.xml index 811520f93..b211defa5 100644 --- a/src/Resources/config/validation/PageTranslation.xml +++ b/src/Resources/config/validation/PageTranslation.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - - + + @@ -32,10 +32,10 @@ - - + + @@ -44,10 +44,10 @@ - - + + diff --git a/src/Resources/config/validation/Template.xml b/src/Resources/config/validation/Template.xml index 9972c09c3..ff0fccfb2 100644 --- a/src/Resources/config/validation/Template.xml +++ b/src/Resources/config/validation/Template.xml @@ -3,31 +3,31 @@ xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + - + - + - - + + diff --git a/src/Resources/public/build/bitbag-cms-admin.css b/src/Resources/public/build/bitbag-cms-admin.css deleted file mode 100644 index f99496016..000000000 --- a/src/Resources/public/build/bitbag-cms-admin.css +++ /dev/null @@ -1 +0,0 @@ -#bitbag-cms-resource-preview-modal{height:100%}#bitbag-cms-resource-preview-modal iframe{height:100vh;width:100%}#bitbag-cms-resource-preview-modal .ui.header{padding-bottom:0}.bitbag-cms-import .ui.action.input input[type=file]{display:none}.bitbag-cms-import .ui.action.input input[type=text]{width:auto}.media-list{grid-gap:20px;display:grid;grid-template-columns:repeat(6,150px);margin:0 auto}.media-list__item{align-items:flex-start;display:flex;flex-direction:column;justify-content:space-between;max-width:150px;position:relative!important}.media-list__item__label,.media-list__item__label>strong{word-wrap:break-word!important;white-space:-moz-pre-wrap!important;white-space:-webkit-pre-wrap!important;white-space:-pre-wrap!important;white-space:-o-pre-wrap!important;white-space:pre-wrap!important;white-space:normal!important;word-break:break-all!important}.media-list__item__label>strong{display:block!important}.media-list__item__input{bottom:10px;position:absolute!important;right:10px;z-index:99}.media-list__item__input:hover{cursor:pointer}.media-list__item__img{height:150px!important;width:150px!important}.btn{display:inline-block!important;font-size:1.4em!important}.btn:hover{cursor:pointer}.page-number{font-size:1.4em!important}.btn-delete{color:#db2828;cursor:pointer;font-weight:700;height:20px;position:absolute;right:30px;width:20px;z-index:5}.btn-delete.is-hidden{opacity:.2;pointer-events:none}.bitbag-media-autocomplete .dropdown.icon{pointer-events:none}.bitbag-media-autocomplete .search{cursor:pointer!important}.bb-collection-item{margin-bottom:1em}.bb-collection-item-delete{margin-top:5px!important}.cke_notifications_area{display:none}.help-text{font-size:12px;margin-top:-10px;opacity:.5} \ No newline at end of file diff --git a/src/Resources/public/build/bitbag-cms-admin.js b/src/Resources/public/build/bitbag-cms-admin.js deleted file mode 100644 index 90e473396..000000000 --- a/src/Resources/public/build/bitbag-cms-admin.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see bitbag-cms-admin.js.LICENSE.txt */ -(()=>{var t={461:()=>{$(document).ready((function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){$(e).autoComplete()}));var t="#bitbag_sylius_cms_plugin_page_contentElements",e=$(t).length?t:"#bitbag_sylius_cms_plugin_block_contentElements";$(e).length&&($(document).on("collection-form-add",(function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){void 0===$._data($(e).get(0),"events")&&$(e).autoComplete()})),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)}))})),$.fn.extend({loadContentConfiguration:function(t){t.querySelector("".concat(e,' select[name*="type"]')).onchange=function(){var t=this.parentElement,e=document.createElement("div"),r=this.selectedOptions[0];e.innerHTML=r.getAttribute("data-configuration");var n=t.nextElementSibling;t.parentElement.replaceChild(e,n);var o=n.querySelector("input");o||(o=n.querySelector("textarea"));var i=o.getAttribute("name"),a=e.querySelectorAll("input");a.length||(a=e.querySelectorAll("textarea")),a.forEach((function(t){var r=t.getAttribute("name");r&&(r=i.replace(i.substring(i.indexOf("[configuration]")+15),r.substring(r.indexOf("configuration")+13)),$(t).attr("name",r),$(e).find(".bitbag-media-autocomplete").autoComplete(),$(e).find(".sylius-autocomplete").autoComplete())}))}}}),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)})),$(document).loadContentConfiguration(document.querySelector("".concat(e,' [data-form-collection="item"]'))))}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(()=>{"use strict";r(461);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{textField:"data-bb-cms-text",fileField:"data-bb-cms-file"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.textField=document.querySelector("[".concat(e.textField,"]")),this.fileField=document.querySelector("[".concat(e.fileField,"]"))},n=[{key:"init",value:function(){if("object"!==t(this.config))throw new Error("Bitbag CMS Plugin - HandleCsvUpload class config is not a valid object");this._handleFields()}},{key:"_handleFields",value:function(){this._handleTextField(),this._handleFileField()}},{key:"_handleTextField",value:function(){var t=this;this.textField.addEventListener("click",(function(){t.fileField.click()}))}},{key:"_handleFileField",value:function(){var t=this;this.fileField.addEventListener("change",(function(e){t.textField.value=e.target.files[0].name}))}}],n&&e(r.prototype,n),o&&e(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}();const i=function(t,e,r){var n=new CustomEvent("".concat("bb",".").concat(e),{detail:r});return t.dispatchEvent(n),t};function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function _(){}var S={};f(S,c,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,c)&&(S=L);var x=_.prototype=b.prototype=Object.create(S);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=d(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==l(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=d(e,r,n);if("normal"===l.type){if(o=n.done?m:y,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function c(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function s(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{wrappersIndicator:"data-bb-cms-wrapper",lockFieldIndicator:"data-bb-cms-toggle-slug",bbTarget:"bitbag_sylius_cms_plugin_page",nameField:"bitbag_sylius_cms_plugin_page_name"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wrappers=document.querySelectorAll("[".concat(e.wrappersIndicator,"]")),this.lockFieldIndicator="[".concat(e.lockFieldIndicator,"]"),this.bbTarget=e.bbTarget,this.config=e,this.nameField=document.getElementById("".concat(e.nameField))},e=[{key:"init",value:function(){if("object"!==l(this.config))throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config is not a valid object");if("string"!=typeof this.lockFieldIndicator||"string"!=typeof this.bbTarget)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config key values are not valid strings");if(!this.nameField)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate name field not found");this._handleFields()}},{key:"_handleFields",value:function(){var t=this;this.wrappers.forEach((function(e){var r=e.dataset.locale,n=e.querySelector("#".concat(t.bbTarget,"_translations_").concat(r,"_slug"));if(n||(n=e.querySelector("#".concat(t.bbTarget,"_slug"))),n){var o;t.nameField.addEventListener("input",(function(e){e.preventDefault(),n.readOnly||(clearTimeout(o),o=setTimeout((function(){t._updateSlug(n,t.nameField.value)}),1e3))}));var i=e.querySelector(t.lockFieldIndicator);i&&i.addEventListener("click",(function(e){e.preventDefault(),t._toggleSlugModification(n,i)}))}}))}},{key:"_updateSlug",value:(o=u(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i(e,"cms.slug.update.start"),e.parentNode.classList.add("loading"),t.next=4,this._getValidSlug(e.dataset.url,r);case 4:e.value=t.sent,e.parentNode.classList.remove("loading"),i(e,"cms.slug.update.end");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"_getValidSlug",value:(n=u(a().mark((function t(e,r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("".concat(e,"?name=").concat(encodeURIComponent(r)));case 3:return n=t.sent,t.next=6,n.json();case 6:return o=t.sent,t.abrupt("return",o.slug);case 10:t.prev=10,t.t0=t.catch(0),console.error("BitBag CMS Plugin - HandleSlugUpdate class error : ".concat(t.t0));case 13:case"end":return t.stop()}}),t,null,[[0,10]])}))),function(t,e){return n.apply(this,arguments)})},{key:"_toggleSlugModification",value:function(t,e){t.readOnly=!t.readOnly;var r=e.querySelector("i");r.classList.toggle("lock"),r.classList.toggle("unlock")}}],e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function _(){}var S={};l(S,a,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,a)&&(S=L);var x=_.prototype=b.prototype=Object.create(S);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==m(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function p(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function y(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{previewButton:"data-bb-cms-preview-btn",previewModal:"data-bb-cms-preview-modal",channelSwitch:"data-bb-cms-channel",localeSwitch:"data-bb-cms-locale"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.button=document.querySelector("[".concat(e.previewButton,"]")),this.modal=document.querySelector("[".concat(e.previewModal,"]")),this.modalSelector=e.previewModal,this.channelSelector=e.channelSwitch,this.localeSelector=e.localeSwitch},e=[{key:"init",value:function(){if("object"!==m(this.config))throw new Error("Bitbag CMS Plugin - HandlePreview class config is not a valid object");if("string"!=typeof this.localeSelector||"string"!=typeof this.channelSelector||"string"!=typeof this.modalSelector)throw new Error("Bitbag CMS Plugin - HandlePreview class config key values are not valid strings");this._resourcePreview()}},{key:"_$_CKEDITOR_MODAL_SHOW",value:function(){return $("[".concat(this.modalSelector,"]")).modal("show")}},{key:"_$_CKEDITOR_UPDATE_INSTANCES",value:function(){y(CKEDITOR.instances).forEach((function(t){return t.updateElement()}))}},{key:"_resourcePreview",value:function(){var t=this;this.button.addEventListener("click",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.channelSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.localeSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()}))}},{key:"_createPreview",value:(n=d().mark((function t(){var e,r,n,o,a,c,u,l,s;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.modal.querySelector(".ui.loadable").classList.add("loading"),this.modal.disabled=!0,e=document.querySelector("[".concat(this.channelSelector,"]")).value,r=document.querySelector("[".concat(this.localeSelector,"]")).value,n=this.button.dataset.url,o=this.button.closest("form"),a={method:"POST",body:new FormData(o)},t.prev=7,i(this.modal,"cms.create.preview.start"),t.next=11,fetch("".concat(n,"?_channel_code=").concat(e,"&_locale=").concat(r),a);case 11:return c=t.sent,t.next=14,c.text();case 14:u=t.sent,l=new Blob([u],{type:"text/html",charset:"utf-8"}),s=window.URL.createObjectURL(l),this.modal.querySelector("iframe").src=s,i(this.modal,"cms.create.preview.completed",u),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(7),console.error("BitBag CMS Plugin - HandlePreview class error : ".concat(t.t0)),i(this.modal,"cms.create.preview.error",t.t0);case 25:return t.prev=25,this.modal.querySelector(".ui.loadable").classList.remove("loading"),this.modal.disabled=!1,i(this.modal,"cms.create.preview.end"),t.finish(25);case 30:case"end":return t.stop()}}),t,this,[[7,21,25,30]])})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){p(i,r,o,a,c,"next",t)}function c(t){p(i,r,o,a,c,"throw",t)}a(void 0)}))},function(){return o.apply(this,arguments)})}],e&&g(t.prototype,e),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function _(){_=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(F([])));E&&E!==r&&n.call(E,a)&&(w=E);var L=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==k(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:d,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function S(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{bbMediaContainer:"data-bb-cms-autocomplete",choiceName:"data-bb-cms-choice-name",choiceValue:"data-bb-cms-choice-value",criteriaType:"data-bb-cms-criteria-type",criteriaName:"data-bb-cms-criteria-name",editUrl:"data-bb-cms-load-edit-url",nameMessage:"data-bb-cms-name-message",deleteButton:"data-bb-cms-delete-selected",choosenPreview:"data-bb-cms-selected-image",selectMenu:"data-bb-cms-selection-menu",selectInput:"data-bb-cms-image-select",placeholder:"data-bb-cms-placeholder",limit:30};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.mediaContainers=document.querySelectorAll("[".concat(e.bbMediaContainer,"]")),this.deleteButton="[".concat(e.deleteButton,"]"),this.selectMenu="[".concat(e.selectMenu,"]"),this.selectInput="[".concat(e.selectInput,"]"),this.placeholder="[".concat(e.placeholder,"]")},e=[{key:"init",value:function(){var t=this;if("object"!==k(this.config))throw new Error("Bitbag CMS Plugin - HandleAutoComplete class config is not a valid object");this.mediaContainers.forEach((function(e){t._handleSavedValue(e),t._handleImageChoice(e),t._handleResetBtn(e)}))}},{key:"_handleResetBtn",value:function(t){var e=this,r=t.querySelector(this.deleteButton);""!==t.querySelector("input[type=hidden]").value?(r.classList.remove("is-hidden"),r.addEventListener("click",(function(){e._resetValues(t)}))):r.classList.add("is-hidden")}},{key:"_handleImageChoice",value:function(t){var e,r=this;t.querySelector(this.selectInput).addEventListener("click",(function(e){e.preventDefault(),r._getMediaImages(t)})),t.querySelector(this.selectInput).addEventListener("input",(function(n){n.preventDefault(),clearTimeout(e),e=setTimeout((function(){r._getMediaImages(t,n.target.value)}),500)})),t.querySelector("input[type=hidden]").addEventListener("change",(function(e){e.preventDefault(),r._handleResetBtn(t)}))}},{key:"_handleSavedValue",value:(o=x(_().mark((function t(e){var r,n,o,a,c,u,l;return _().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""!==e.querySelector("input[type=hidden]").value){t.next=2;break}return t.abrupt("return");case 2:return r="".concat(e.dataset.bbCmsLoadEditUrl,"?").concat(e.querySelector("input[type=hidden]").value.split(",").filter(String).map((function(t){return"code[]=".concat(t)})).join("&")),t.prev=3,i(e,"cms.media.saved.reload.start"),e.classList.add("loading"),t.next=8,fetch(r);case 8:return n=t.sent,t.next=11,n.json();case 11:o=t.sent,this._addToSelectMenu(o,e),a=[],null!==(c=e.querySelector(this.selectMenu))&&(a=c.children),u=S(a);try{for(u.s();!(l=u.n()).done;)l.value.click()}catch(t){u.e(t)}finally{u.f()}i(e,"cms.media.saved.reload.completed",o),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(3),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.saved.reload.error",t.t0);case 25:return t.prev=25,e.classList.remove("loading"),i(e,"cms.media.saved.reload.end"),t.finish(25);case 29:case"end":return t.stop()}}),t,this,[[3,21,25,29]])}))),function(t){return o.apply(this,arguments)})},{key:"_getMediaImages",value:(n=x(_().mark((function t(e){var r,n,o,a,c,u,l,s,f=arguments;return _().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=f.length>1&&void 0!==f[1]&&f[1],n=e.dataset.bbCmsUrl,o=e.dataset.bbCmsCriteriaType,a=r?"&criteria[search][value]=".concat(r):"",c="".concat(n,"&limit=").concat(this.config.limit,"&criteria[search][type]=").concat(o,"&criteria[search][value]=").concat(a),t.prev=5,i(e,"cms.media.display.start"),e.classList.add("loading"),t.next=10,fetch(c);case 10:return u=t.sent,t.next=13,u.json();case 13:l=t.sent,s=l._embedded.items,this._addToSelectMenu(s,e),i(e,"cms.media.display.completed",l),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(5),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.display.error",t.t0);case 23:return t.prev=23,e.classList.remove("loading"),i(e,"cms.media.display.end"),t.finish(23);case 27:case"end":return t.stop()}}),t,this,[[5,19,23,27]])}))),function(t){return n.apply(this,arguments)})},{key:"_resetValues",value:function(t){i(t,"cms.media.reset.start"),t.querySelector("input[type=hidden]").value="",t.querySelector(this.selectMenu).innerHTML="",t.querySelector(this.placeholder).innerHTML="",i(t,"cms.media.reset.end")}},{key:"_addToSelectMenu",value:function(t,e){var r=this;i(e,"cms.media.display.update.start");var n=e.querySelector(this.selectMenu);n.innerHTML="",null!==t&&t.forEach((function(t){n.insertAdjacentHTML("beforeend",r._itemTemplate(t.path,t.code.trim()))})),i(e,"cms.media.display.update.end")}},{key:"_itemTemplate",value:function(t,e){return'
').concat(e,"
")}}],e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function C(t,e){for(var r=0;r0&&(new h).init(),document.querySelectorAll("[data-bb-cms-preview-btn]").length>0&&(new w).init(),document.querySelector('[data-bb-target="cms-handle-autocomplete"]')&&(new P).init(),document.querySelector(".collection-type-items")&&(new F).init(),document.querySelector("[data-bb-cms-load-template]")&&(new N).init()})()})(); \ No newline at end of file diff --git a/src/Resources/public/build/bitbag-cms-shop.css b/src/Resources/public/build/bitbag-cms-shop.css deleted file mode 100644 index 537bb045c..000000000 --- a/src/Resources/public/build/bitbag-cms-shop.css +++ /dev/null @@ -1 +0,0 @@ -.bitbag-block{margin-bottom:20px}.bitbag-block img{max-width:100%}.carousel-wrapper{position:relative}.carousel-wrapper .carousel{margin:0 -1em}.carousel-wrapper .carousel-nav .carousel-left{left:30px}.carousel-wrapper .carousel-nav .carousel-right{right:30px}.carousel-wrapper .carousel-nav .carousel-left,.carousel-wrapper .carousel-nav .carousel-right{position:absolute;top:50%;transform:translateY(-50%)}.carousel-wrapper .carousel-item{padding:5px 1em}.teaser__content{margin-top:10px}.teaser__description{margin-top:5px}.teaser__read-more{display:block;margin-top:20px}[class^=cms_content_element__]:not(:last-child){margin-bottom:1rem} \ No newline at end of file diff --git a/src/Resources/public/build/entrypoints.json b/src/Resources/public/build/entrypoints.json index 00da06b81..38903804c 100644 --- a/src/Resources/public/build/entrypoints.json +++ b/src/Resources/public/build/entrypoints.json @@ -1,19 +1,19 @@ { "entrypoints": { - "bitbag-cms-shop": { + "sylius-cms-shop": { "css": [ - "/public/build/bitbag-cms-shop.css" + "/public/build/sylius-cms-shop.css" ], "js": [ - "/public/build/bitbag-cms-shop.js" + "/public/build/sylius-cms-shop.js" ] }, - "bitbag-cms-admin": { + "sylius-cms-admin": { "css": [ - "/public/build/bitbag-cms-admin.css" + "/public/build/sylius-cms-admin.css" ], "js": [ - "/public/build/bitbag-cms-admin.js" + "/public/build/sylius-cms-admin.js" ] } } diff --git a/src/Resources/public/build/manifest.json b/src/Resources/public/build/manifest.json index fe4d82bd6..328e454c0 100644 --- a/src/Resources/public/build/manifest.json +++ b/src/Resources/public/build/manifest.json @@ -1,6 +1,6 @@ { - "public/build/bitbag-cms-shop.css": "/public/build/bitbag-cms-shop.css", - "public/build/bitbag-cms-shop.js": "/public/build/bitbag-cms-shop.js", - "public/build/bitbag-cms-admin.css": "/public/build/bitbag-cms-admin.css", - "public/build/bitbag-cms-admin.js": "/public/build/bitbag-cms-admin.js" + "public/build/sylius-cms-shop.css": "/public/build/sylius-cms-shop.css", + "public/build/sylius-cms-shop.js": "/public/build/sylius-cms-shop.js", + "public/build/sylius-cms-admin.css": "/public/build/sylius-cms-admin.css", + "public/build/sylius-cms-admin.js": "/public/build/sylius-cms-admin.js" } \ No newline at end of file diff --git a/src/Resources/public/build/sylius-cms-admin.css b/src/Resources/public/build/sylius-cms-admin.css new file mode 100644 index 000000000..49fef1082 --- /dev/null +++ b/src/Resources/public/build/sylius-cms-admin.css @@ -0,0 +1 @@ +#cms-resource-preview-modal{height:100%}#cms-resource-preview-modal iframe{height:100vh;width:100%}#cms-resource-preview-modal .ui.header{padding-bottom:0}.cms-import .ui.action.input input[type=file]{display:none}.cms-import .ui.action.input input[type=text]{width:auto}.media-list{grid-gap:20px;display:grid;grid-template-columns:repeat(6,150px);margin:0 auto}.media-list__item{align-items:flex-start;display:flex;flex-direction:column;justify-content:space-between;max-width:150px;position:relative!important}.media-list__item__label,.media-list__item__label>strong{word-wrap:break-word!important;white-space:-moz-pre-wrap!important;white-space:-webkit-pre-wrap!important;white-space:-pre-wrap!important;white-space:-o-pre-wrap!important;white-space:pre-wrap!important;white-space:normal!important;word-break:break-all!important}.media-list__item__label>strong{display:block!important}.media-list__item__input{bottom:10px;position:absolute!important;right:10px;z-index:99}.media-list__item__input:hover{cursor:pointer}.media-list__item__img{height:150px!important;width:150px!important}.btn{display:inline-block!important;font-size:1.4em!important}.btn:hover{cursor:pointer}.page-number{font-size:1.4em!important}.btn-delete{color:#db2828;cursor:pointer;font-weight:700;height:20px;position:absolute;right:30px;width:20px;z-index:5}.btn-delete.is-hidden{opacity:.2;pointer-events:none}.cms-media-autocomplete .dropdown.icon{pointer-events:none}.cms-media-autocomplete .search{cursor:pointer!important}.bb-collection-item{margin-bottom:1em}.bb-collection-item-delete{margin-top:5px!important}.cke_notifications_area{display:none}.help-text{font-size:12px;margin-top:-10px;opacity:.5} \ No newline at end of file diff --git a/src/Resources/public/build/sylius-cms-admin.js b/src/Resources/public/build/sylius-cms-admin.js new file mode 100644 index 000000000..e1bee5273 --- /dev/null +++ b/src/Resources/public/build/sylius-cms-admin.js @@ -0,0 +1,2 @@ +/*! For license information please see sylius-cms-admin.js.LICENSE.txt */ +(()=>{var t={461:()=>{$(document).ready((function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){$(e).autoComplete()}));var t="#sylius_cms_page_contentElements",e=$(t).length?t:"#sylius_cms_block_contentElements";$(e).length&&($(document).on("collection-form-add",(function(){$(".bitbag-media-autocomplete, .sylius-autocomplete").each((function(t,e){void 0===$._data($(e).get(0),"events")&&$(e).autoComplete()})),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)}))})),$.fn.extend({loadContentConfiguration:function(t){t.querySelector("".concat(e,' select[name*="type"]')).onchange=function(){var t=this.parentElement,e=document.createElement("div"),r=this.selectedOptions[0];e.innerHTML=r.getAttribute("data-configuration");var n=t.nextElementSibling;t.parentElement.replaceChild(e,n);var o=n.querySelector("input");o||(o=n.querySelector("textarea"));var i=o.getAttribute("name"),a=e.querySelectorAll("input");a.length||(a=e.querySelectorAll("textarea")),a.forEach((function(t){var r=t.getAttribute("name");r&&(r=i.replace(i.substring(i.indexOf("[configuration]")+15),r.substring(r.indexOf("configuration")+13)),$(t).attr("name",r),$(e).find(".bitbag-media-autocomplete").autoComplete(),$(e).find(".sylius-autocomplete").autoComplete())}))}}}),$("".concat(e,' [data-form-collection="item"]')).each((function(t,e){$(document).loadContentConfiguration(e)})),$(document).loadContentConfiguration(document.querySelector("".concat(e,' [data-form-collection="item"]'))))}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(()=>{"use strict";r(461);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{textField:"data-bb-cms-text",fileField:"data-bb-cms-file"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.textField=document.querySelector("[".concat(e.textField,"]")),this.fileField=document.querySelector("[".concat(e.fileField,"]"))},n=[{key:"init",value:function(){if("object"!==t(this.config))throw new Error("Bitbag CMS Plugin - HandleCsvUpload class config is not a valid object");this._handleFields()}},{key:"_handleFields",value:function(){this._handleTextField(),this._handleFileField()}},{key:"_handleTextField",value:function(){var t=this;this.textField.addEventListener("click",(function(){t.fileField.click()}))}},{key:"_handleFileField",value:function(){var t=this;this.fileField.addEventListener("change",(function(e){t.textField.value=e.target.files[0].name}))}}],n&&e(r.prototype,n),o&&e(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}();const i=function(t,e,r){var n=new CustomEvent("".concat("bb",".").concat(e),{detail:r});return t.dispatchEvent(n),t};function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function S(){}var _={};f(_,c,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,c)&&(_=L);var x=S.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=d(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==l(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=d(e,r,n);if("normal"===l.type){if(o=n.done?m:y,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function c(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function s(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{wrappersIndicator:"data-bb-cms-wrapper",lockFieldIndicator:"data-bb-cms-toggle-slug",bbTarget:"sylius_cms_page",nameField:"sylius_cms_page_name"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wrappers=document.querySelectorAll("[".concat(e.wrappersIndicator,"]")),this.lockFieldIndicator="[".concat(e.lockFieldIndicator,"]"),this.bbTarget=e.bbTarget,this.config=e,this.nameField=document.getElementById("".concat(e.nameField))},e=[{key:"init",value:function(){if("object"!==l(this.config))throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config is not a valid object");if("string"!=typeof this.lockFieldIndicator||"string"!=typeof this.bbTarget)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate class config key values are not valid strings");if(!this.nameField)throw new Error("Bitbag CMS Plugin - HandleSlugUpdate name field not found");this._handleFields()}},{key:"_handleFields",value:function(){var t=this;this.wrappers.forEach((function(e){var r=e.dataset.locale,n=e.querySelector("#".concat(t.bbTarget,"_translations_").concat(r,"_slug"));if(n||(n=e.querySelector("#".concat(t.bbTarget,"_slug"))),n){var o;t.nameField.addEventListener("input",(function(e){e.preventDefault(),n.readOnly||(clearTimeout(o),o=setTimeout((function(){t._updateSlug(n,t.nameField.value)}),1e3))}));var i=e.querySelector(t.lockFieldIndicator);i&&i.addEventListener("click",(function(e){e.preventDefault(),t._toggleSlugModification(n,i)}))}}))}},{key:"_updateSlug",value:(o=u(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i(e,"cms.slug.update.start"),e.parentNode.classList.add("loading"),t.next=4,this._getValidSlug(e.dataset.url,r);case 4:e.value=t.sent,e.parentNode.classList.remove("loading"),i(e,"cms.slug.update.end");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"_getValidSlug",value:(n=u(a().mark((function t(e,r){var n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("".concat(e,"?name=").concat(encodeURIComponent(r)));case 3:return n=t.sent,t.next=6,n.json();case 6:return o=t.sent,t.abrupt("return",o.slug);case 10:t.prev=10,t.t0=t.catch(0),console.error("BitBag CMS Plugin - HandleSlugUpdate class error : ".concat(t.t0));case 13:case"end":return t.stop()}}),t,null,[[0,10]])}))),function(t,e){return n.apply(this,arguments)})},{key:"_toggleSlugModification",value:function(t,e){t.readOnly=!t.readOnly;var r=e.querySelector("i");r.classList.toggle("lock"),r.classList.toggle("unlock")}}],e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function d(){d=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function S(){}var _={};l(_,a,(function(){return this}));var E=Object.getPrototypeOf,L=E&&E(E(F([])));L&&L!==r&&n.call(L,a)&&(_=L);var x=S.prototype=b.prototype=Object.create(_);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==m(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function p(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function y(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{previewButton:"data-bb-cms-preview-btn",previewModal:"data-bb-cms-preview-modal",channelSwitch:"data-bb-cms-channel",localeSwitch:"data-bb-cms-locale"};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.button=document.querySelector("[".concat(e.previewButton,"]")),this.modal=document.querySelector("[".concat(e.previewModal,"]")),this.modalSelector=e.previewModal,this.channelSelector=e.channelSwitch,this.localeSelector=e.localeSwitch},e=[{key:"init",value:function(){if("object"!==m(this.config))throw new Error("Bitbag CMS Plugin - HandlePreview class config is not a valid object");if("string"!=typeof this.localeSelector||"string"!=typeof this.channelSelector||"string"!=typeof this.modalSelector)throw new Error("Bitbag CMS Plugin - HandlePreview class config key values are not valid strings");this._resourcePreview()}},{key:"_$_CKEDITOR_MODAL_SHOW",value:function(){return $("[".concat(this.modalSelector,"]")).modal("show")}},{key:"_$_CKEDITOR_UPDATE_INSTANCES",value:function(){y(CKEDITOR.instances).forEach((function(t){return t.updateElement()}))}},{key:"_resourcePreview",value:function(){var t=this;this.button.addEventListener("click",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.channelSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()})),document.querySelector("[".concat(this.localeSelector,"]")).addEventListener("change",(function(e){e.preventDefault(),t._$_CKEDITOR_UPDATE_INSTANCES,t._createPreview(),t._$_CKEDITOR_MODAL_SHOW()}))}},{key:"_createPreview",value:(n=d().mark((function t(){var e,r,n,o,a,c,u,l,s;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.modal.querySelector(".ui.loadable").classList.add("loading"),this.modal.disabled=!0,e=document.querySelector("[".concat(this.channelSelector,"]")).value,r=document.querySelector("[".concat(this.localeSelector,"]")).value,n=this.button.dataset.url,o=this.button.closest("form"),a={method:"POST",body:new FormData(o)},t.prev=7,i(this.modal,"cms.create.preview.start"),t.next=11,fetch("".concat(n,"?_channel_code=").concat(e,"&_locale=").concat(r),a);case 11:return c=t.sent,t.next=14,c.text();case 14:u=t.sent,l=new Blob([u],{type:"text/html",charset:"utf-8"}),s=window.URL.createObjectURL(l),this.modal.querySelector("iframe").src=s,i(this.modal,"cms.create.preview.completed",u),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(7),console.error("BitBag CMS Plugin - HandlePreview class error : ".concat(t.t0)),i(this.modal,"cms.create.preview.error",t.t0);case 25:return t.prev=25,this.modal.querySelector(".ui.loadable").classList.remove("loading"),this.modal.disabled=!1,i(this.modal,"cms.create.preview.end"),t.finish(25);case 30:case"end":return t.stop()}}),t,this,[[7,21,25,30]])})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){p(i,r,o,a,c,"next",t)}function c(t){p(i,r,o,a,c,"throw",t)}a(void 0)}))},function(){return o.apply(this,arguments)})}],e&&g(t.prototype,e),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function S(){S=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",v={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(F([])));E&&E!==r&&n.call(E,a)&&(w=E);var L=b.prototype=m.prototype=Object.create(w);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==k(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===v)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?y:d,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:F(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function _(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:{bbMediaContainer:"data-bb-cms-autocomplete",choiceName:"data-bb-cms-choice-name",choiceValue:"data-bb-cms-choice-value",criteriaType:"data-bb-cms-criteria-type",criteriaName:"data-bb-cms-criteria-name",editUrl:"data-bb-cms-load-edit-url",nameMessage:"data-bb-cms-name-message",deleteButton:"data-bb-cms-delete-selected",choosenPreview:"data-bb-cms-selected-image",selectMenu:"data-bb-cms-selection-menu",selectInput:"data-bb-cms-image-select",placeholder:"data-bb-cms-placeholder",limit:30};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.mediaContainers=document.querySelectorAll("[".concat(e.bbMediaContainer,"]")),this.deleteButton="[".concat(e.deleteButton,"]"),this.selectMenu="[".concat(e.selectMenu,"]"),this.selectInput="[".concat(e.selectInput,"]"),this.placeholder="[".concat(e.placeholder,"]")},e=[{key:"init",value:function(){var t=this;if("object"!==k(this.config))throw new Error("Bitbag CMS Plugin - HandleAutoComplete class config is not a valid object");this.mediaContainers.forEach((function(e){t._handleSavedValue(e),t._handleImageChoice(e),t._handleResetBtn(e)}))}},{key:"_handleResetBtn",value:function(t){var e=this,r=t.querySelector(this.deleteButton);""!==t.querySelector("input[type=hidden]").value?(r.classList.remove("is-hidden"),r.addEventListener("click",(function(){e._resetValues(t)}))):r.classList.add("is-hidden")}},{key:"_handleImageChoice",value:function(t){var e,r=this;t.querySelector(this.selectInput).addEventListener("click",(function(e){e.preventDefault(),r._getMediaImages(t)})),t.querySelector(this.selectInput).addEventListener("input",(function(n){n.preventDefault(),clearTimeout(e),e=setTimeout((function(){r._getMediaImages(t,n.target.value)}),500)})),t.querySelector("input[type=hidden]").addEventListener("change",(function(e){e.preventDefault(),r._handleResetBtn(t)}))}},{key:"_handleSavedValue",value:(o=x(S().mark((function t(e){var r,n,o,a,c,u,l;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(""!==e.querySelector("input[type=hidden]").value){t.next=2;break}return t.abrupt("return");case 2:return r="".concat(e.dataset.bbCmsLoadEditUrl,"?").concat(e.querySelector("input[type=hidden]").value.split(",").filter(String).map((function(t){return"code[]=".concat(t)})).join("&")),t.prev=3,i(e,"cms.media.saved.reload.start"),e.classList.add("loading"),t.next=8,fetch(r);case 8:return n=t.sent,t.next=11,n.json();case 11:o=t.sent,this._addToSelectMenu(o,e),a=[],null!==(c=e.querySelector(this.selectMenu))&&(a=c.children),u=_(a);try{for(u.s();!(l=u.n()).done;)l.value.click()}catch(t){u.e(t)}finally{u.f()}i(e,"cms.media.saved.reload.completed",o),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(3),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.saved.reload.error",t.t0);case 25:return t.prev=25,e.classList.remove("loading"),i(e,"cms.media.saved.reload.end"),t.finish(25);case 29:case"end":return t.stop()}}),t,this,[[3,21,25,29]])}))),function(t){return o.apply(this,arguments)})},{key:"_getMediaImages",value:(n=x(S().mark((function t(e){var r,n,o,a,c,u,l,s,f=arguments;return S().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=f.length>1&&void 0!==f[1]&&f[1],n=e.dataset.bbCmsUrl,o=e.dataset.bbCmsCriteriaType,a=r?"&criteria[search][value]=".concat(r):"",c="".concat(n,"&limit=").concat(this.config.limit,"&criteria[search][type]=").concat(o,"&criteria[search][value]=").concat(a),t.prev=5,i(e,"cms.media.display.start"),e.classList.add("loading"),t.next=10,fetch(c);case 10:return u=t.sent,t.next=13,u.json();case 13:l=t.sent,s=l._embedded.items,this._addToSelectMenu(s,e),i(e,"cms.media.display.completed",l),t.next=23;break;case 19:t.prev=19,t.t0=t.catch(5),console.error("BitBag CMS Plugin - HandleAutoComplete class error : ".concat(t.t0)),i(e,"cms.media.display.error",t.t0);case 23:return t.prev=23,e.classList.remove("loading"),i(e,"cms.media.display.end"),t.finish(23);case 27:case"end":return t.stop()}}),t,this,[[5,19,23,27]])}))),function(t){return n.apply(this,arguments)})},{key:"_resetValues",value:function(t){i(t,"cms.media.reset.start"),t.querySelector("input[type=hidden]").value="",t.querySelector(this.selectMenu).innerHTML="",t.querySelector(this.placeholder).innerHTML="",i(t,"cms.media.reset.end")}},{key:"_addToSelectMenu",value:function(t,e){var r=this;i(e,"cms.media.display.update.start");var n=e.querySelector(this.selectMenu);n.innerHTML="",null!==t&&t.forEach((function(t){n.insertAdjacentHTML("beforeend",r._itemTemplate(t.path,t.code.trim()))})),i(e,"cms.media.display.update.end")}},{key:"_itemTemplate",value:function(t,e){return'
').concat(e,"
")}}],e&&j(t.prototype,e),r&&j(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function C(t,e){for(var r=0;r0&&(new h).init(),document.querySelectorAll("[data-bb-cms-preview-btn]").length>0&&(new w).init(),document.querySelector('[data-bb-target="cms-handle-autocomplete"]')&&(new P).init(),document.querySelector(".collection-type-items")&&(new F).init(),document.querySelector("[data-bb-cms-load-template]")&&(new N).init()})()})(); \ No newline at end of file diff --git a/src/Resources/public/build/sylius-cms-admin.js.LICENSE.txt b/src/Resources/public/build/sylius-cms-admin.js.LICENSE.txt new file mode 100644 index 000000000..ae386fb79 --- /dev/null +++ b/src/Resources/public/build/sylius-cms-admin.js.LICENSE.txt @@ -0,0 +1 @@ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ diff --git a/src/Resources/public/build/sylius-cms-shop.css b/src/Resources/public/build/sylius-cms-shop.css new file mode 100644 index 000000000..fa24c6ec9 --- /dev/null +++ b/src/Resources/public/build/sylius-cms-shop.css @@ -0,0 +1 @@ +.cms-block{margin-bottom:20px}.cms-block img{max-width:100%}.carousel-wrapper{position:relative}.carousel-wrapper .carousel{margin:0 -1em}.carousel-wrapper .carousel-nav .carousel-left{left:30px}.carousel-wrapper .carousel-nav .carousel-right{right:30px}.carousel-wrapper .carousel-nav .carousel-left,.carousel-wrapper .carousel-nav .carousel-right{position:absolute;top:50%;transform:translateY(-50%)}.carousel-wrapper .carousel-item{padding:5px 1em}.teaser__content{margin-top:10px}.teaser__description{margin-top:5px}.teaser__read-more{display:block;margin-top:20px}[class^=cms_content_element__]:not(:last-child){margin-bottom:1rem} \ No newline at end of file diff --git a/src/Resources/public/build/sylius-cms-shop.js b/src/Resources/public/build/sylius-cms-shop.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/Resources/public/js/ckeditor-plugins/dialogs/index.js b/src/Resources/public/js/ckeditor-plugins/dialogs/index.js index f5cbafb3f..130e7450f 100644 --- a/src/Resources/public/js/ckeditor-plugins/dialogs/index.js +++ b/src/Resources/public/js/ckeditor-plugins/dialogs/index.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - let oldValue = null; let phrase = ''; let currentPage = 1; diff --git a/src/Resources/public/js/ckeditor-plugins/image/plugin.js b/src/Resources/public/js/ckeditor-plugins/image/plugin.js index d992f2be3..2dd595991 100644 --- a/src/Resources/public/js/ckeditor-plugins/image/plugin.js +++ b/src/Resources/public/js/ckeditor-plugins/image/plugin.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - CKEDITOR.plugins.add('mediaImage', { icons: 'mediaimage', init(editor) { diff --git a/src/Resources/public/js/ckeditor-plugins/video/plugin.js b/src/Resources/public/js/ckeditor-plugins/video/plugin.js index 3ffce1eea..ab61e9eeb 100644 --- a/src/Resources/public/js/ckeditor-plugins/video/plugin.js +++ b/src/Resources/public/js/ckeditor-plugins/video/plugin.js @@ -1,9 +1,3 @@ -/* - This file was created by developers working at BitBag - Do you need more information about us and what we do? Visit our https://bitbag.io website! - We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career -*/ - CKEDITOR.plugins.add('mediaVideo', { icons: 'mediavideo', init(editor) { diff --git a/src/Resources/translations/messages.cs.yml b/src/Resources/translations/messages.cs.yml index f63a89a22..138695e21 100755 --- a/src/Resources/translations/messages.cs.yml +++ b/src/Resources/translations/messages.cs.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: collections: Kolekce blocks: Bloky diff --git a/src/Resources/translations/messages.cs_CZ.yml b/src/Resources/translations/messages.cs_CZ.yml index f63a89a22..138695e21 100755 --- a/src/Resources/translations/messages.cs_CZ.yml +++ b/src/Resources/translations/messages.cs_CZ.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: collections: Kolekce blocks: Bloky diff --git a/src/Resources/translations/messages.de.yml b/src/Resources/translations/messages.de.yml index 1d58b5d60..8a6c8b76e 100755 --- a/src/Resources/translations/messages.de.yml +++ b/src/Resources/translations/messages.de.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blöcke block: Block diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index 1a948ceab..9d160b4b0 100755 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blocks block: Block diff --git a/src/Resources/translations/messages.es.yml b/src/Resources/translations/messages.es.yml index d868601ca..53ee94a2b 100755 --- a/src/Resources/translations/messages.es.yml +++ b/src/Resources/translations/messages.es.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Bloques block: Bloque diff --git a/src/Resources/translations/messages.fr.yml b/src/Resources/translations/messages.fr.yml index e63e3436f..4bf0e5c34 100755 --- a/src/Resources/translations/messages.fr.yml +++ b/src/Resources/translations/messages.fr.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blocs block: Bloc diff --git a/src/Resources/translations/messages.hr.yml b/src/Resources/translations/messages.hr.yml index c2ce3ee42..9c4f08be5 100755 --- a/src/Resources/translations/messages.hr.yml +++ b/src/Resources/translations/messages.hr.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blokovi block: Blok diff --git a/src/Resources/translations/messages.lt.yml b/src/Resources/translations/messages.lt.yml index b61436900..1613f8ddf 100644 --- a/src/Resources/translations/messages.lt.yml +++ b/src/Resources/translations/messages.lt.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blokai block: Blokas diff --git a/src/Resources/translations/messages.nl.yml b/src/Resources/translations/messages.nl.yml index 593236a30..3ee4aee72 100755 --- a/src/Resources/translations/messages.nl.yml +++ b/src/Resources/translations/messages.nl.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Blokken block: Blok diff --git a/src/Resources/translations/messages.pl.yml b/src/Resources/translations/messages.pl.yml index 60111e84f..c56192f43 100755 --- a/src/Resources/translations/messages.pl.yml +++ b/src/Resources/translations/messages.pl.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Bloki block: Blok diff --git a/src/Resources/translations/messages.ru.yml b/src/Resources/translations/messages.ru.yml index e791f2fa1..15f0d76f7 100755 --- a/src/Resources/translations/messages.ru.yml +++ b/src/Resources/translations/messages.ru.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Блоки block: Блок diff --git a/src/Resources/translations/messages.sk.yml b/src/Resources/translations/messages.sk.yml index 7755e99d9..c06934c17 100644 --- a/src/Resources/translations/messages.sk.yml +++ b/src/Resources/translations/messages.sk.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Bloky block: Blok diff --git a/src/Resources/translations/messages.uk.yml b/src/Resources/translations/messages.uk.yml index 877787130..0aa6e91a3 100755 --- a/src/Resources/translations/messages.uk.yml +++ b/src/Resources/translations/messages.uk.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: ui: blocks: Блоки block: Блок diff --git a/src/Resources/translations/validators.cs.yml b/src/Resources/translations/validators.cs.yml index 04d2f6cae..874a9aa40 100644 --- a/src/Resources/translations/validators.cs.yml +++ b/src/Resources/translations/validators.cs.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Pouze PNG, SVG a JPEG soubory jsou povoleny. diff --git a/src/Resources/translations/validators.de.yml b/src/Resources/translations/validators.de.yml index 56254cdce..1174bffb7 100755 --- a/src/Resources/translations/validators.de.yml +++ b/src/Resources/translations/validators.de.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Nur PNG, SVG und JPEG Dateien sind erlaubt. diff --git a/src/Resources/translations/validators.en.yml b/src/Resources/translations/validators.en.yml index 9bdc6b924..34b174ba3 100755 --- a/src/Resources/translations/validators.en.yml +++ b/src/Resources/translations/validators.en.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Only PNG, SVG and JPEG files are allowed. diff --git a/src/Resources/translations/validators.es.yml b/src/Resources/translations/validators.es.yml index f7f531190..99682d19a 100755 --- a/src/Resources/translations/validators.es.yml +++ b/src/Resources/translations/validators.es.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Solo se permiten archivos PNG, SVG y JPEG. diff --git a/src/Resources/translations/validators.fr.yml b/src/Resources/translations/validators.fr.yml index 4047a473a..d28c80914 100755 --- a/src/Resources/translations/validators.fr.yml +++ b/src/Resources/translations/validators.fr.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Seuls les fichiers PNG, SVG et JPEG sont autorisés. diff --git a/src/Resources/translations/validators.hr.yml b/src/Resources/translations/validators.hr.yml index 9100c21a7..cab29c8da 100755 --- a/src/Resources/translations/validators.hr.yml +++ b/src/Resources/translations/validators.hr.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Samo su PNG, SVG ili JPG formati dopušteni. diff --git a/src/Resources/translations/validators.lt.yml b/src/Resources/translations/validators.lt.yml index d232adee1..fb91f3259 100644 --- a/src/Resources/translations/validators.lt.yml +++ b/src/Resources/translations/validators.lt.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Leidžiami tik PNG ir JPEG formatų failai. diff --git a/src/Resources/translations/validators.nl.yml b/src/Resources/translations/validators.nl.yml index 4434b1d01..d12575455 100755 --- a/src/Resources/translations/validators.nl.yml +++ b/src/Resources/translations/validators.nl.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Alleen PNG, SVG en JPEG bestanden zijn toegestaan. diff --git a/src/Resources/translations/validators.pl.yml b/src/Resources/translations/validators.pl.yml index c56e7bc79..e27a4c7b3 100755 --- a/src/Resources/translations/validators.pl.yml +++ b/src/Resources/translations/validators.pl.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Only PNG, SVG and JPEG files are allowed. diff --git a/src/Resources/translations/validators.ru.yml b/src/Resources/translations/validators.ru.yml index c3001f00c..8b71515b4 100755 --- a/src/Resources/translations/validators.ru.yml +++ b/src/Resources/translations/validators.ru.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Только PNG, SVG или JPEG. diff --git a/src/Resources/translations/validators.sk.yml b/src/Resources/translations/validators.sk.yml index e21f54d9f..1aff25712 100755 --- a/src/Resources/translations/validators.sk.yml +++ b/src/Resources/translations/validators.sk.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Iba PNG, SVG a JPEG súbory sú povolené. diff --git a/src/Resources/translations/validators.uk.yml b/src/Resources/translations/validators.uk.yml index 2955ba818..b106ad07a 100755 --- a/src/Resources/translations/validators.uk.yml +++ b/src/Resources/translations/validators.uk.yml @@ -1,4 +1,4 @@ -bitbag_sylius_cms_plugin: +sylius_cms: block: image: mime_types: Тільки PNG, SVG чи JPEG. diff --git a/src/Resources/views/Block/Crud/_form.html.twig b/src/Resources/views/Block/Crud/_form.html.twig index f6fb33f31..23c580606 100755 --- a/src/Resources/views/Block/Crud/_form.html.twig +++ b/src/Resources/views/Block/Crud/_form.html.twig @@ -1,8 +1,8 @@ -{% from '@BitBagSyliusCmsPlugin/Macro/translationForm.html.twig' import translationForm %} -{% form_theme form '@BitBagSyliusCmsPlugin/Form/theme.html.twig' %} +{% from '@SyliusCmsPlugin/Macro/translationForm.html.twig' import translationForm %} +{% form_theme form '@SyliusCmsPlugin/Form/theme.html.twig' %} -{% include '@BitBagSyliusCmsPlugin/Modal/_resourcePreview.html.twig' %} -{% include '@BitBagSyliusCmsPlugin/Modal/_loadTemplateConfirmation.html.twig' %} +{% include '@SyliusCmsPlugin/Modal/_resourcePreview.html.twig' %} +{% include '@SyliusCmsPlugin/Modal/_loadTemplateConfirmation.html.twig' %}
@@ -12,20 +12,19 @@ {{ form_row(form.code) }} {{ form_row(form.enabled) }} {{ form_row(form.channels) }} - {{ form_row(form.locales) }} {{ form_row(form.collections) }} - {{ 'bitbag_sylius_cms_plugin.ui.preview'|trans }} + {{ 'sylius_cms.ui.preview'|trans }}
-

{{ 'bitbag_sylius_cms_plugin.ui.manage_block_display'|trans }}

+

{{ 'sylius_cms.ui.manage_block_display'|trans }}

{{ form_row(form.products) }} {{ form_row(form.productsInTaxons) }} {{ form_row(form.taxons) }} @@ -33,8 +32,9 @@
-

{{ 'bitbag_sylius_cms_plugin.ui.content_elements.title'|trans }}

- {% include '@BitBagSyliusCmsPlugin/Template/form.html.twig' with {ajax_url: path('bitbag_sylius_cms_plugin_admin_ajax_template_content_by_id', {'id': 'REPLACE_ID'}) } %} +

{{ 'sylius_cms.ui.content_elements.title'|trans }}

+ {% include '@SyliusCmsPlugin/Template/form.html.twig' with {ajax_url: path('sylius_cms_admin_ajax_template_content_by_id', {'id': 'REPLACE_ID'}) } %} + {% include '@SyliusCmsPlugin/Locale/form.html.twig' %}
{{ form_row(form.contentElements) }} diff --git a/src/Resources/views/Block/preview.html.twig b/src/Resources/views/Block/preview.html.twig index b34fb16e0..9d8eb74cb 100755 --- a/src/Resources/views/Block/preview.html.twig +++ b/src/Resources/views/Block/preview.html.twig @@ -7,7 +7,7 @@ {% block content %}
- {{ bitbag_cms_render_content_elements(block) }} + {{ sylius_cms_render_content_elements(block) }}
{% endblock %} diff --git a/src/Resources/views/Collection/Crud/_form.html.twig b/src/Resources/views/Collection/Crud/_form.html.twig index cd5b3c5a9..afc93a9c2 100755 --- a/src/Resources/views/Collection/Crud/_form.html.twig +++ b/src/Resources/views/Collection/Crud/_form.html.twig @@ -1,5 +1,5 @@ {% from '@SyliusAdmin/Macro/translationForm.html.twig' import translationForm %} -{% form_theme form '@BitBagSyliusCmsPlugin/Form/theme.html.twig' %} +{% form_theme form '@SyliusCmsPlugin/Form/theme.html.twig' %} {{ form_errors(form) }} diff --git a/src/Resources/views/ContentConfiguration/_action.html.twig b/src/Resources/views/ContentConfiguration/_action.html.twig index b7f55e28c..fd98adfe9 100644 --- a/src/Resources/views/ContentConfiguration/_action.html.twig +++ b/src/Resources/views/ContentConfiguration/_action.html.twig @@ -1,4 +1,4 @@ -{% form_theme field '@BitBagSyliusCmsPlugin/Form/theme.html.twig' %} +{% form_theme field '@SyliusCmsPlugin/Form/theme.html.twig' %} {{ form_row(field) }} diff --git a/src/Resources/views/CrudUi/create.html.twig b/src/Resources/views/CrudUi/create.html.twig index 98ae01951..3b81f7165 100755 --- a/src/Resources/views/CrudUi/create.html.twig +++ b/src/Resources/views/CrudUi/create.html.twig @@ -1,4 +1,4 @@ -{% extends '@BitBagSyliusCmsPlugin/layout.html.twig' %} +{% extends '@SyliusCmsPlugin/layout.html.twig' %} {% import '@SyliusUi/Macro/headers.html.twig' as headers %} diff --git a/src/Resources/views/CrudUi/index.html.twig b/src/Resources/views/CrudUi/index.html.twig index 02ed75bde..f658effd1 100644 --- a/src/Resources/views/CrudUi/index.html.twig +++ b/src/Resources/views/CrudUi/index.html.twig @@ -1,4 +1,4 @@ -{% extends '@BitBagSyliusCmsPlugin/layout.html.twig' %} +{% extends '@SyliusCmsPlugin/layout.html.twig' %} {% import '@SyliusUi/Macro/headers.html.twig' as headers %} diff --git a/src/Resources/views/CrudUi/update.html.twig b/src/Resources/views/CrudUi/update.html.twig index bb2f65af1..40080fd98 100755 --- a/src/Resources/views/CrudUi/update.html.twig +++ b/src/Resources/views/CrudUi/update.html.twig @@ -1,4 +1,4 @@ -{% extends '@BitBagSyliusCmsPlugin/layout.html.twig' %} +{% extends '@SyliusCmsPlugin/layout.html.twig' %} {% import '@SyliusUi/Macro/headers.html.twig' as headers %} {% import '@SyliusUi/Macro/buttons.html.twig' as buttons %} diff --git a/src/Resources/views/Form/theme.html.twig b/src/Resources/views/Form/theme.html.twig index 6b2a39579..290dc6dee 100755 --- a/src/Resources/views/Form/theme.html.twig +++ b/src/Resources/views/Form/theme.html.twig @@ -1,38 +1,38 @@ {% extends '@SyliusUi/Form/theme.html.twig' %} -{% block bitbag_collection_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_collection_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_collection_by_code')}) }} +{% block sylius_collection_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_collection_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_collection_by_code')}) }} {% endblock %} -{% block bitbag_page_collection_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_page_collection_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_collection_by_code')}) }} +{% block sylius_page_collection_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_page_collection_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_collection_by_code')}) }} {% endblock %} -{% block bitbag_page_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_page_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_page_by_code')}) }} +{% block sylius_page_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_page_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_page_by_code')}) }} {% endblock %} -{% block bitbag_block_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_block_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_block_by_code')}) }} +{% block sylius_block_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_block_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_block_by_code')}) }} {% endblock %} -{% block bitbag_template_page_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_template_page_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_template_by_id')}) }} +{% block sylius_template_page_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_template_page_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_template_by_id')}) }} {% endblock %} -{% block bitbag_template_block_autocomplete_choice_row %} - {{ form_row(form, {'remote_url': path('bitbag_sylius_cms_plugin_admin_ajax_template_block_by_name_phrase'), 'load_edit_url': path('bitbag_sylius_cms_plugin_admin_ajax_template_by_id')}) }} +{% block sylius_template_block_autocomplete_choice_row %} + {{ form_row(form, {'remote_url': path('sylius_cms_admin_ajax_template_block_by_name_phrase'), 'load_edit_url': path('sylius_cms_admin_ajax_template_by_id')}) }} {% endblock %} -{% block bitbag_media_autocomplete_choice_row %} +{% block sylius_media_autocomplete_choice_row %}
{{- form_label(form) -}}