I am trying to create a field plugin that displays an image using a passed path property as the src:
photo:
label: Photo
type: thumb // the custom field
path: page('products').findBy('id', page.items.toStructure.first.id).thumb
Kirby::plugin('alex/thumb', [
'fields' => [
'thumb' => [
'props' => [
'label' => function($label) {
return $label;
},
'path' => function($path) {
return $path; // How can I execute this?
},
]
]
]
]);
panel.plugin('alex/thumb', {
fields: {
thumb: {
props: {
label: String,
path: String
},
template: `
<div>
<k-headline>{{ label }}</k-headline>
<k-image src="{{ path }}" />
</div>
`
}
}
});
How can I get the result of the path query, instead of getting it as text?