I made some kirbytag extensions. When I render them with other content like images and text paragraphs some of them don’t show up in the right order.
Kirby::plugin('a/plugin', [
'tags' => [
'bookrelated' => [
'html' => function($tag) {
$pgUid = "scopri/lavori/". $tag->attr('bookrelated');
$pg = page($pgUid);
if(!$pg){ die("Page '". $tag->item ."' not found"); }
else {
return snippet('book-item', [
"pg" => $pg,
"small" => true,
]);
}
}
],
],
]);
// in panel
(image: someimage.jpg)
Some paragraph text.
_Related items_
(bookrelated: berlino)
In the rendered html bookrelated
appears before the image and the paragraph.
I have the feeling it has to do with how I return the html.
Doing:
return snippet('book-item', [
"pg" => $pg,
"small" => true,
], true);
partially solves it but leads to another odd behaviour: some of the html renders as a string and is displayed in the page as html code.
What am I missing here?