From e5eb6c3a735d72a0569a7f0334de5e6c934b26df Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Mon, 30 Sep 2024 16:10:19 +0200 Subject: [PATCH] feat: Add link in logos blade --- src/Form/Type/ImageType.php | 1 + src/Form/Type/UiElement/LogosUiElementType.php | 3 +++ .../views/Admin/UiElement/logos_ui_element.html.twig | 11 ++++++++++- .../views/Shop/UiElement/logos_ui_element.html.twig | 11 ++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Form/Type/ImageType.php b/src/Form/Type/ImageType.php index 12c60e5..26d3b42 100644 --- a/src/Form/Type/ImageType.php +++ b/src/Form/Type/ImageType.php @@ -25,6 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void { if (!$options['with_link']) { $builder->remove('link'); + $builder->remove('link_type'); } if (!$options['with_alignment']) { $builder->remove('align'); diff --git a/src/Form/Type/UiElement/LogosUiElementType.php b/src/Form/Type/UiElement/LogosUiElementType.php index 5ed595b..23e59b3 100644 --- a/src/Form/Type/UiElement/LogosUiElementType.php +++ b/src/Form/Type/UiElement/LogosUiElementType.php @@ -54,6 +54,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'attr' => [ 'class' => 'ui segment secondary collection--flex', ], + 'entry_options' => [ + 'with_link' => true, + ], ]) ; } 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 3565e92..f0e6f12 100644 --- a/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig +++ b/src/Resources/views/Admin/UiElement/logos_ui_element.html.twig @@ -6,6 +6,8 @@ element fields: - logos - image - alt + - link + - link_type #}
@@ -16,7 +18,14 @@ element fields:
{% for logo in element.logos %}
- {{ logo.alt|default('') }} + {% if logo.link|default('') %} + {% set linkIsBlank = logo.link_type is defined and logo.link_type == constant('MonsieurBiz\\SyliusRichEditorPlugin\\Form\\Type\\LinkTypeType::TYPE_EXTERNAL') %} + + {{ logo.alt|default('') }} + + {% else %} + {{ logo.alt|default('') }} + {% endif %}
{% endfor %}
diff --git a/src/Resources/views/Shop/UiElement/logos_ui_element.html.twig b/src/Resources/views/Shop/UiElement/logos_ui_element.html.twig index 3565e92..f0e6f12 100644 --- a/src/Resources/views/Shop/UiElement/logos_ui_element.html.twig +++ b/src/Resources/views/Shop/UiElement/logos_ui_element.html.twig @@ -6,6 +6,8 @@ element fields: - logos - image - alt + - link + - link_type #}
@@ -16,7 +18,14 @@ element fields:
{% for logo in element.logos %}
- {{ logo.alt|default('') }} + {% if logo.link|default('') %} + {% set linkIsBlank = logo.link_type is defined and logo.link_type == constant('MonsieurBiz\\SyliusRichEditorPlugin\\Form\\Type\\LinkTypeType::TYPE_EXTERNAL') %} + + {{ logo.alt|default('') }} + + {% else %} + {{ logo.alt|default('') }} + {% endif %}
{% endfor %}