Can't use toStructure() or yaml() in kirbytext tag

I have a very basic YAML field, and I’m trying to access it from within a custom kirbytext tag. I’ve succeeded in echoing the contents of the field, but when I try to use toStructure() or yaml() to access the individual items in the field, it just fails silently (Kirby seems to not even try to process the tag, as it just echos the kirbytext tag to the screen).

I feel like I must be doing something really boneheaded, as I see that in this thread, toStructure() was able to be used inside a custom tag.

The Field

----
vidgallery: 

-
    video: (vimeo: //vimeo.com/226462302)
    thumb: gallery-hvm.jpg
-
    video: (vimeo: //vimeo.com/226350355)
    thumb: gallery-infrastructure.jpg
-
    video: (vimeo: //vimeo.com/226343408)
    thumb: gallery-docker.jpg

The Tag

<?php
    kirbytext::$tags['vidgallery'] = array(
        'html' => function($tag) {
            $html = '';
            $videos = $tag->page()->vidgallery()->toStructure();
            foreach ($videos AS $video) {
                $html .= $video->thumb();
            }
            return $html;
        }
    );

Did you enter the entries via the Panel or manually? I think there should be single quotes around the Vimeo tags.

1 Like

Manually. And yes, that was the problem. Thanks!

1 Like

YAML is a indentation badass, always doublecheck this too. :wink: