Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

replace FileType with ImageType for images #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Form/Type/CustomBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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',
])
;
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/ProductBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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, [
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/TaxonBlockType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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, [
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Page/Admin/CustomBlock/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
*/
public function getBlockContents()
{
return $this->getElement('block')->getHtml();
return $this->getElement('cmf-block')->getHtml();
}

/**
* {@inheritdoc}
*/
public function getBlockImageUrl()
{
return $this->getElement('block')->find('css', 'img')->getAttribute('src');
return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src');
}

/**
Expand All @@ -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',
]);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Page/Admin/ProductBlock/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
*/
public function getBlockContents()
{
return $this->getElement('block')->getHtml();
return $this->getElement('cmf-block')->getHtml();
}

/**
* {@inheritdoc}
*/
public function getBlockImageUrl()
{
return $this->getElement('block')->find('css', 'img')->getAttribute('src');
return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src');
}

/**
Expand All @@ -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',
]);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Behat/Page/Admin/StringBlock/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
*/
public function getBlockContents()
{
return $this->getElement('block')->getHtml();
return $this->getElement('cmf-block')->getHtml();
}

/**
Expand All @@ -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',
]);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Page/Admin/TaxonBlock/ShowPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
*/
public function getBlockContents()
{
return $this->getElement('block')->getHtml();
return $this->getElement('cmf-block')->getHtml();
}

/**
* {@inheritdoc}
*/
public function getBlockImageUrl()
{
return $this->getElement('block')->find('css', 'img')->getAttribute('src');
return $this->getElement('cmf-block')->find('css', 'img')->getAttribute('src');
}

/**
Expand All @@ -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',
]);
}

Expand Down