Skip to content
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
5 changes: 5 additions & 0 deletions Form/Type/ImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

Expand Down
1 change: 1 addition & 0 deletions Form/Type/PictureEntryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions Resources/translations/AdvancedContentBundle.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions Resources/translations/AdvancedContentBundle.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions Resources/views/Field/front/image.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
<a href="{{ link }}">
{% endif %}

{% if sources is defined and sources|length > 0 %}
<picture>
{% for source in sources %}
Expand All @@ -21,4 +25,8 @@
{% if sources is defined and sources|length > 0 %}
</picture>
{% endif %}

{% if link is defined and link is not empty %}
</a>
{% endif %}
{% endif %}
3 changes: 3 additions & 0 deletions Resources/views/Form/content.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down