kirby-editor-gallery-block icon indicating copy to clipboard operation
kirby-editor-gallery-block copied to clipboard

Index of current image and count() of all images in each gallery?

Open larshoie opened this issue 4 years ago • 0 comments

Hey!

I really love the plugin, thanks so much for making it!

I'm trying to do something kind of like a slideshow and I'm wondering if it's possible to get the index of the current image and the count() of all images in each gallery block?

In the gallery.php snippet I've tried this (which I found on the forum)

<?php 
    $total = $images->count();
    ...
    ...
?>

and then in the loop I would like to be able to do something like this:

<?= $images->indexOf($image) + 1 . "/" . $total;?>

Currently when I try this I'm getting this error: Method Kirby\Editor\Blocks::__toString() must not throw an exception, caught Error: Call to a member function count() on array

larshoie avatar Sep 13 '20 11:09 larshoie