diff --git a/src/Form/Type/ImageType.php b/src/Form/Type/ImageType.php index 9e3ea14..12c60e5 100644 --- a/src/Form/Type/ImageType.php +++ b/src/Form/Type/ImageType.php @@ -29,19 +29,24 @@ public function buildForm(FormBuilderInterface $builder, array $options): void if (!$options['with_alignment']) { $builder->remove('align'); } + if (!$options['with_title']) { + $builder->remove('title'); + } } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ - 'with_link' => true, - 'with_alignment' => true, + 'with_link' => false, + 'with_alignment' => false, + 'with_title' => false, 'attr' => [ 'class' => 'ui segment', ], ]); $resolver->setAllowedTypes('with_link', ['null', 'bool']); $resolver->setAllowedTypes('with_alignment', ['null', 'bool']); + $resolver->setAllowedTypes('with_title', ['null', 'bool']); } public function getParent(): string diff --git a/src/Form/Type/UiElement/LinksUiElementType.php b/src/Form/Type/UiElement/LinksUiElementType.php index 53c2454..cdb317b 100644 --- a/src/Form/Type/UiElement/LinksUiElementType.php +++ b/src/Form/Type/UiElement/LinksUiElementType.php @@ -17,9 +17,9 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; -use Symfony\Component\Form\Extension\Core\Type\TextType; #[AsUiElement( code: 'monsieurbiz_ui_elements.links_ui_element', diff --git a/src/Form/Type/UiElement/LogosUiElementType.php b/src/Form/Type/UiElement/LogosUiElementType.php index fea1f49..ac71ae8 100644 --- a/src/Form/Type/UiElement/LogosUiElementType.php +++ b/src/Form/Type/UiElement/LogosUiElementType.php @@ -47,10 +47,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('logos', CollectionType::class, [ 'label' => 'monsieurbiz_ui_elements.common.fields.logos', 'entry_type' => ImageType::class, - 'entry_options' => [ - 'with_link' => false, - 'with_alignment' => false, - ], 'allow_add' => true, 'allow_delete' => true, 'constraints' => [new Assert\Valid()], diff --git a/src/Form/Type/UiElement/TextWithImageUiElementType.php b/src/Form/Type/UiElement/TextWithImageUiElementType.php index 9eea1bc..22a36fa 100644 --- a/src/Form/Type/UiElement/TextWithImageUiElementType.php +++ b/src/Form/Type/UiElement/TextWithImageUiElementType.php @@ -52,13 +52,11 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ], ]) ->add('image', ImageType::class, [ - 'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.image.field.image', - 'required' => true, - 'with_link' => false, - 'with_alignment' => false, + 'label' => 'monsieurbiz_ui_elements.common.fields.image_with_text', + 'required' => false, ]) ->add('imageAlign', ChoiceType::class, [ - 'label' => 'monsieurbiz_ui_elements.common.fields.alignment', + 'label' => 'monsieurbiz_ui_elements.common.fields.image_alignment', 'required' => true, 'choices' => [ 'monsieurbiz_ui_elements.ui_element.text_with_image_ui_element.fields.image_align.choices.left' => self::IMAGE_POSITION_LEFT, diff --git a/src/Resources/translations/messages.en.yaml b/src/Resources/translations/messages.en.yaml index 4420019..c173adb 100644 --- a/src/Resources/translations/messages.en.yaml +++ b/src/Resources/translations/messages.en.yaml @@ -15,6 +15,8 @@ monsieurbiz_ui_elements: author: "Author" content: "Content" image: "Image" + image_alignment: "Image alignment" + image_with_text: "Image with the text" logos: "Logos" ui_element: hero_ui_element: diff --git a/src/Resources/translations/messages.fr.yaml b/src/Resources/translations/messages.fr.yaml index 0b54300..4ca1189 100644 --- a/src/Resources/translations/messages.fr.yaml +++ b/src/Resources/translations/messages.fr.yaml @@ -15,6 +15,8 @@ monsieurbiz_ui_elements: author: "Auteur" content: "Contenu" image: "Image" + image_alignment: "Alignement de l'image" + image_with_text: "Image accompagnant le texte" logos: "Logos" ui_element: hero_ui_element: diff --git a/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig b/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig index 96b4dbc..3565e92 100644 --- a/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig +++ b/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig @@ -6,7 +6,6 @@ element fields: - logos - image - alt - - title #}
@@ -17,7 +16,7 @@ element fields:
{% for logo in element.logos %}
- {{ logo.alt|default('') }} + {{ logo.alt|default('') }}
{% endfor %}
diff --git a/src/Resources/views/Admin/UiElement/text_with_image_ui_element.html.twig b/src/Resources/views/Admin/UiElement/text_with_image_ui_element.html.twig index 475add6..a9f8fa6 100644 --- a/src/Resources/views/Admin/UiElement/text_with_image_ui_element.html.twig +++ b/src/Resources/views/Admin/UiElement/text_with_image_ui_element.html.twig @@ -6,7 +6,6 @@ element fields: - image - image - alt - - title - imageAlign #} {% set isRightAlign = (element.imageAlign|default('')) == constant('MonsieurBiz\\SyliusUiElementsPlugin\\Form\\Type\\UiElement\\TextWithImageUiElementType::IMAGE_POSITION_RIGHT') %} @@ -15,7 +14,6 @@ element fields: {{ element.image.alt|default('') }} @@ -14,10 +13,10 @@ element fields:
{{ element.title }}
{% endif %} -
+
{% for logo in element.logos %}
- {{ logo.alt|default('') }} + {{ logo.alt|default('') }}
{% endfor %}
diff --git a/src/Resources/views/Shop/UiElement/text_with_image_ui_element.html.twig b/src/Resources/views/Shop/UiElement/text_with_image_ui_element.html.twig index 475add6..a9f8fa6 100644 --- a/src/Resources/views/Shop/UiElement/text_with_image_ui_element.html.twig +++ b/src/Resources/views/Shop/UiElement/text_with_image_ui_element.html.twig @@ -6,7 +6,6 @@ element fields: - image - image - alt - - title - imageAlign #} {% set isRightAlign = (element.imageAlign|default('')) == constant('MonsieurBiz\\SyliusUiElementsPlugin\\Form\\Type\\UiElement\\TextWithImageUiElementType::IMAGE_POSITION_RIGHT') %} @@ -15,7 +14,6 @@ element fields: