Hey
I want to reuse my blocksnippets as “normal” snippets.
I have built this “big_image” block snippet. And i am using the snippet with the blockbuilder.
<?php if ($image = $data->image_global_data()->toFile()) : ?>
<picture width="<?= $image->dimensions()->width() ?>" height="<?= $image->dimensions()->height() ?>">
<?php if ($webPImage = $site->image($image->name() . '.webp')) : ?>
<source data-srcset="<?= $webPImage = $site->image($image->name() . '.webp')->url() ?>" type="image/webp">
<?php endif ?>
<?php if ($jpgImage = $site->image($image->name() . '.jpg')) : ?>
<source data-srcset="<?= $jpgImage = $site->image($image->name() . '.jpg')->url() ?>" type="image/jpg">
<?php endif ?>
<?php if ($pngImage = $site->image($image->name() . '.png')) : ?>
<source data-srcset="<?= $pngImage = $site->image($image->name() . '.png')->url() ?>" type="image/png">
<?php endif ?>
<img alt="<?= $image->alt() ?>" title="<?= $image->title() ?>" width="<?= $image->dimensions()->width() ?>" height="<?= $image->dimensions()->height() ?>" src="<?= $image->resize(25)->url() ?>" data-src="<?= $image->url() ?>" class="lazyload">
</picture>
<figcaption class="image-caption ta-center">
<?= $image->caption() ?>
</figcaption>
<?php endif ?>
<!-- image_global_data is the name in the subfieldset -->
But i want to use the snippet as “normal” snippet too.
I want to do sth like this:
<?php snippet('big_image', ['page()->image_via_panel()->toFile())' => $image]); ?>
How can i do this?