Hi there,
I’m currently working on a multi language site, it is in German and English.
I have a meta field set up in my images, so that my client can choose wether or not to show the images in one section of the page. As it seems like radiobuttons are not possible for image options, I am just using a string.
What I need to do is check if there is a string in there which matches ‘y’ (i.e. for yes). I can do this, but it means the user will have to add this string for the image on both languages…I want them to be able to just have to enter ‘y’ on the default language and only have to check for this value in my template.
What I have so far is:
<?php foreach($page->images() as $image): ?>
<?php if($image->showimage() == 'y'): ?>
<div class = "content--wrap__img--wrap">
<img src="<?= $image->url() ?>" alt="">
</div>
<?php endif ?>
<?php endforeach ?>
I have tried this:
<?php foreach($page->images() as $image): ?>
<?php if($image->content->('de')->showimage() == 'y'): ?>
<div class = "content--wrap__img--wrap">
<img src="<?= $image->url() ?>" alt="">
</div>
<?php endif ?>
<?php endforeach ?>
and this:
<?php foreach($site->find($page)->content('de')->images() as $image): ?>
<?php if($image->showimage() == 'y'): ?>
<div class = "content--wrap__img--wrap">
<img src="<?= $image->url() ?>" alt="">
</div>
<?php endif ?>
<?php endforeach ?>
But with no luck …is this even possible?