Custom Tag Kirby 3

#1

Hi

I’m creating a custom tag for a website I’m doing, I can’t manage to load an image from its filename:

<?php
Kirby::plugin('portfolio/test', [
  'tags' => [
    'illustration' => [
      'attr' => [
        'id','file','caption'
      ],
      'html' => function($tag) {

        return '<span class="image-link">' . $tag->value . '</span> <span id="' . $tag->id . '"> <span class="project-image">' .$tag->parent()->file("' . $tag->file . '"). '</span><span class="project-caption">' . $tag->caption . '</span></span>';

      }
    ]
  ]
]); 

The bit that is not working is obviously that one but I don’t really understand why:

' .$tag->parent()->file("' . $tag->file . '"). '

Thanks!

#2

Should be

$tag->parent()->file($tag->file)
#3

I just figured out, thanks texnixe!