Hi,
I can’t get my image from a structure field. I’m using the fieldtoggle plugin. This is my blueprint
gallery:
label: Galerie
type: structure
entry: >
{{imagetoggle}}, {{legende}}
fields:
imagetoggle:
label: Image ou vidéo
type: fieldtoggle
options:
image: "Image"
video: "Vidéo"
show:
image: imagefield
video: video
hide:
image: video
video: imagefield
imagefield:
label: Image
type: image
video:
label: Vidéo
type: text
icon: link
help: 'ID de la vidéo à intégrer. Pour youtube'
legende:
label: Légende
type: textarea
And I’m just trying to echo them like that
<?php $gallery = $pageworks->gallery()->yaml(); foreach($gallery as $gal): ?>
<?php $img = $gal['imagefield'] ?>
<?php $caption = $gal['legende'] ?>
<figure>
<?php echo $img ?>
<img class="lozad" data-src="<?php echo thumb($img, array('width' => 1350, 'quality' => 100))->url() ?>" alt="...">
<figcaption><?php echo $caption ?></figcaption>
</figure>
<?php endforeach ?>
The $gal['imagefield']
is not writing the correct URL.
Even if I try $img = $gal['imagefield']->toFile()
, the data-src
is always empty…