I have actually decided to continue pursuing my original plan of calling the images for each gallery from individual subpages of the blogarticle page I want the gallery to appear in. I started writing a kirbytag to be able to call them inline. I based it off of the “downloads” example in the documentation.
Here is my code:
<?php
kirbytext::$tags['gallery'] = array(
'html' => function($tag) {
$gallerypage = $tag->attr('gallery');
$html .= '<ul>';
foreach($tag->page()->children($gallerypage)->images() as $slide) {
$html .= '<li>';
$html .= '<img src="' . $slide->url() . '">';
$html .= '</li>';
}
$html .= '</ul>';
return $html;
}
);
However, it isn’t paying attention to the actual subpage I tell it to get the images from. In my text in the panel I can enter (gallery: Doodles)
and it will just fetch all the images associated to any subpage. And when I add a second gallery, e.g. (gallery: Paintings)
it will do the exact same, resulting in two sets of all the images.
I know I read about others having a similar problem with the Kirby Gallery Field, here:
https://forum.getkirby.com/t/kirby-gallery-field/4636/18
…so I am hoping this can be solved some way! The Kirby official documentation for How to create custom kirbytags even says “of course you can extend this to generate entire galleries…” so there must be a way. Any help with this issue is VERY APPRECIATED!!! Thanks so much in advance!