diff --git a/src/Form/Type/CustomBlockType.php b/src/Form/Type/CustomBlockType.php index 8475867..5e89dd6 100644 --- a/src/Form/Type/CustomBlockType.php +++ b/src/Form/Type/CustomBlockType.php @@ -3,7 +3,7 @@ namespace Lakion\CmsPlugin\Form\Type; use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; -use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Cmf\Bundle\MediaBundle\Form\Type\ImageType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -27,7 +27,7 @@ public function buildForm(FormBuilderInterface $builder, array $options = []) ->add('linkUrl', TextType::class, [ 'label' => 'lakion_cms.form.custom_block.link', ]) - ->add('image', FileType::class, [ + ->add('image', ImageType::class, [ 'label' => 'lakion_cms.form.custom_block.image', ]) ; diff --git a/src/Form/Type/ProductBlockType.php b/src/Form/Type/ProductBlockType.php index 55b1885..7b7c972 100644 --- a/src/Form/Type/ProductBlockType.php +++ b/src/Form/Type/ProductBlockType.php @@ -4,7 +4,7 @@ use Sylius\Bundle\ProductBundle\Form\Type\ProductAutocompleteChoiceType; use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; -use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Cmf\Bundle\MediaBundle\Form\Type\ImageType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -28,7 +28,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('linkUrl', TextType::class, [ 'label' => 'lakion_cms.form.product_block.link', ]) - ->add('image', FileType::class, [ + ->add('image', ImageType::class, [ 'label' => 'lakion_cms.form.product_block.image', ]) ->add('product', ProductAutocompleteChoiceType::class, [ diff --git a/src/Form/Type/TaxonBlockType.php b/src/Form/Type/TaxonBlockType.php index a66c4b1..c9e420c 100644 --- a/src/Form/Type/TaxonBlockType.php +++ b/src/Form/Type/TaxonBlockType.php @@ -4,7 +4,7 @@ use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonAutocompleteChoiceType; -use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Cmf\Bundle\MediaBundle\Form\Type\ImageType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -28,7 +28,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('linkUrl', TextType::class, [ 'label' => 'lakion_cms.form.taxon_block.link', ]) - ->add('image', FileType::class, [ + ->add('image', ImageType::class, [ 'label' => 'lakion_cms.form.taxon_block.image', ]) ->add('taxon', TaxonAutocompleteChoiceType::class, [ diff --git a/tests/Behat/Page/Admin/CustomBlock/ShowPage.php b/tests/Behat/Page/Admin/CustomBlock/ShowPage.php index 8591c37..aaf79ef 100644 --- a/tests/Behat/Page/Admin/CustomBlock/ShowPage.php +++ b/tests/Behat/Page/Admin/CustomBlock/ShowPage.php @@ -11,7 +11,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface */ public function getBlockContents() { - return $this->getElement('block')->getHtml(); + return $this->getElement('cmf-block')->getHtml(); } /** @@ -19,7 +19,7 @@ public function getBlockContents() */ public function getBlockImageUrl() { - return $this->getElement('block')->find('css', 'img')->getAttribute('src'); + return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src'); } /** @@ -28,7 +28,7 @@ public function getBlockImageUrl() protected function getDefinedElements() { return array_merge(parent::getDefinedElements(), [ - 'block' => '#lakion_cms_block_preview', + 'cmf-block' => '#lakion_cms_block_preview', ]); } diff --git a/tests/Behat/Page/Admin/ProductBlock/ShowPage.php b/tests/Behat/Page/Admin/ProductBlock/ShowPage.php index 8c0bbdb..fd4fa6a 100644 --- a/tests/Behat/Page/Admin/ProductBlock/ShowPage.php +++ b/tests/Behat/Page/Admin/ProductBlock/ShowPage.php @@ -11,7 +11,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface */ public function getBlockContents() { - return $this->getElement('block')->getHtml(); + return $this->getElement('cmf-block')->getHtml(); } /** @@ -19,7 +19,7 @@ public function getBlockContents() */ public function getBlockImageUrl() { - return $this->getElement('block')->find('css', 'img')->getAttribute('src'); + return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src'); } /** @@ -28,7 +28,7 @@ public function getBlockImageUrl() protected function getDefinedElements() { return array_merge(parent::getDefinedElements(), [ - 'block' => '#lakion_cms_block_preview', + 'cmf-block' => '#lakion_cms_block_preview', ]); } diff --git a/tests/Behat/Page/Admin/StringBlock/ShowPage.php b/tests/Behat/Page/Admin/StringBlock/ShowPage.php index 3adabf9..028b435 100644 --- a/tests/Behat/Page/Admin/StringBlock/ShowPage.php +++ b/tests/Behat/Page/Admin/StringBlock/ShowPage.php @@ -11,7 +11,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface */ public function getBlockContents() { - return $this->getElement('block')->getHtml(); + return $this->getElement('cmf-block')->getHtml(); } /** @@ -20,7 +20,7 @@ public function getBlockContents() protected function getDefinedElements() { return array_merge(parent::getDefinedElements(), [ - 'block' => '#lakion_cms_block_preview', + 'cmf-block' => '#lakion_cms_block_preview', ]); } diff --git a/tests/Behat/Page/Admin/TaxonBlock/ShowPage.php b/tests/Behat/Page/Admin/TaxonBlock/ShowPage.php index da0aa89..a9969df 100644 --- a/tests/Behat/Page/Admin/TaxonBlock/ShowPage.php +++ b/tests/Behat/Page/Admin/TaxonBlock/ShowPage.php @@ -11,7 +11,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface */ public function getBlockContents() { - return $this->getElement('block')->getHtml(); + return $this->getElement('cmf-block')->getHtml(); } /** @@ -19,7 +19,7 @@ public function getBlockContents() */ public function getBlockImageUrl() { - return $this->getElement('block')->find('css', 'img')->getAttribute('src'); + return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src'); } /** @@ -28,7 +28,7 @@ public function getBlockImageUrl() protected function getDefinedElements() { return array_merge(parent::getDefinedElements(), [ - 'block' => '#lakion_cms_block_preview', + 'cmf-block' => '#lakion_cms_block_preview', ]); }