Catchable fatal error: Argument 1 passed to Kirby::render() must be an instance of Page, boolean given, called in /Users/nhoffmann/Development/passport/kirby/kirby/component/response.php on line 25 and defined in /Users/nhoffmann/Development/passport/kirby/kirby.php on line 558
I know that the template is found and loaded correctly, cause when I omit passing through $trip, I see half of the template until the error that $trip cannot be found.
I cannot wrap my brain around the error. Any ideas, previous experiences, solutions from anyone?
p.s. and yes I really would not like to put page placeholder into the content folder as this would make the plugin install more complicated
What actually did work is to echo it and then just return false.
It is quite the hack, I guess, and I will see what other problems I will run into with it.
So if anyone has a smoother idea for pages without content files, let me know.
The logic is a bit more precise if you look at the Kirby\Component\Response class, which handles the “hey, we want to make a response out of this mixed input” use case. If you return a string, it will treat it as a page uri:
That’s probably a bad case of tight coupling between this class and a behavior that some Kirby helpers and/or internals expected. ^^ (A more agnostic class would return new Response($response) in that situation.)
Anyway, the clean way to return a HTML response from a route action when the action itself provides the full HTML result would be:
function(…) {
$html = ...;
return new Response($html);
}
You can also handle different HTTP statuses, with e.g; return new Response($html, 'html', 404);