diff --git a/Form/Type/ImageType.php b/Form/Type/ImageType.php index b04367a9..5f012af6 100644 --- a/Form/Type/ImageType.php +++ b/Form/Type/ImageType.php @@ -5,6 +5,7 @@ use Sherlockode\AdvancedContentBundle\Manager\MimeTypeManager; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -31,6 +32,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'field_type.image.alt', 'required' => false, ]) + ->add('link', UrlType::class, [ + 'label' => 'field_type.image.link', + 'required' => false, + ]) ; } diff --git a/Form/Type/PictureEntryType.php b/Form/Type/PictureEntryType.php index d1218942..d9d72220 100644 --- a/Form/Type/PictureEntryType.php +++ b/Form/Type/PictureEntryType.php @@ -15,6 +15,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->remove('alt'); $builder->remove('mime_type'); + $builder->remove('link'); $builder ->add('media_query', TextType::class, [ 'label' => 'field_type.image.media_query', diff --git a/Resources/translations/AdvancedContentBundle.en.yml b/Resources/translations/AdvancedContentBundle.en.yml index fc2ac595..38456768 100644 --- a/Resources/translations/AdvancedContentBundle.en.yml +++ b/Resources/translations/AdvancedContentBundle.en.yml @@ -26,6 +26,7 @@ field_type: picture_main: Main image picture_sources: Alternative images media_query: Media query + link: Image link textarea: label: Textarea iframe: diff --git a/Resources/translations/AdvancedContentBundle.fr.yml b/Resources/translations/AdvancedContentBundle.fr.yml index 03d9b297..bcb1829e 100644 --- a/Resources/translations/AdvancedContentBundle.fr.yml +++ b/Resources/translations/AdvancedContentBundle.fr.yml @@ -26,6 +26,7 @@ field_type: picture_main: Image principale picture_sources: Images alternatives media_query: RequĂȘte media + link: Lien de l'image textarea: label: Zone de texte iframe: diff --git a/Resources/views/Field/front/image.html.twig b/Resources/views/Field/front/image.html.twig index 630a2207..ce235935 100644 --- a/Resources/views/Field/front/image.html.twig +++ b/Resources/views/Field/front/image.html.twig @@ -2,6 +2,10 @@ {% set attributes = acb_get_element_attributes(extra|default([]), 'inline') %} {% set style = attributes.style|default('') %} + {% if link is defined and link is not empty %} + + {% endif %} + {% if sources is defined and sources|length > 0 %} {% for source in sources %} @@ -21,4 +25,8 @@ {% if sources is defined and sources|length > 0 %} {% endif %} + + {% if link is defined and link is not empty %} + + {% endif %} {% endif %} diff --git a/Resources/views/Form/content.html.twig b/Resources/views/Form/content.html.twig index 4027d91c..abff190c 100644 --- a/Resources/views/Form/content.html.twig +++ b/Resources/views/Form/content.html.twig @@ -210,6 +210,9 @@ {% if form.alt is defined %} {{ form_row(form.alt) }} {% endif %} + {% if form.link is defined %} + {{ form_row(form.link) }} + {% endif %} {% if form.mime_type is defined %} {% import "@SherlockodeAdvancedContent/Common/Macros/collapse.html.twig" as macro %}