This plugin adds a media manager to your images, videos and other files type fields in Sylius.
Sylius Version | PHP Version |
---|---|
1.11 | 8.0 - 8.1 |
1.12 | 8.1 - 8.2 |
1.13 | 8.1 - 8.2 |
If you want to use our recipes, you can configure your composer.json by running:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
Install the plugin via composer:
composer require monsieurbiz/sylius-media-manager-plugin
Change your config/bundles.php
file to add this line for the plugin declaration:
<?php
return [
//..
MonsieurBiz\SyliusMediaManagerPlugin\MonsieurBizSyliusMediaManagerPlugin::class => ['all' => true],
];
Copy the plugin configuration files in your config
folder: https://github.com/monsieurbiz/symfony-recipes/tree/master/monsieurbiz/sylius-media-manager-plugin/1.0/config
Add these variables to your .env
:
MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_PUBLIC_FOLDER=%kernel.project_dir%/public
MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_ROOT_FOLDER_FROM_PUBLIC=media
MONSIEURBIZ_SYLIUS_MEDIA_MANAGER_MAX_FILE_SIZE=5M
Copy the templates in the folder dist/templates/
to ensure that form fields are rendered correctly:
cp -R vendor/monsieurbiz/sylius-media-manager-plugin/dist/templates/bundles/* templates/bundles/
Copy the form extension if you want to use it on your product images.
cp -R vendor/monsieurbiz/sylius-media-manager-plugin/dist/src/Form/Extension/ProductImageTypeExtension.php src/Form/Extension/ProductImageTypeExtension.php
Else remove the file templates/bundles/SyliusAdminBundle/Form/imagesTheme.html.twig
You can check the dist folder to check how the plugin is setup on the test application.
Use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\ImageType
Use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\PdfType
Use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\VideoType
Use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\FaviconType
Use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\AudioType
You can find a way to run the plugin without effort in the file DEVELOPMENT.md.
Then you can open an issue or a Pull Request if you want! 😘
Thank you!
This plugin is completely free and released under the MIT License.