Closed CHE1RON closed 1 year ago
There it is!
offtopic: I'd like to see a new (patch) release after this getting merged, so I can further hack on your stuff in production 😆
@CHE1RON Usually, metadata()
is implemented on custom page models as a "real" method, so this was intentional. However, I added the possibility to use Kirby’s "virtual" methods as well, see 02f79b9.
Thanks @fabianmichael for your feedback, I totally forgot about this - but my approach should work in both situations (= no need for both checks), or am I mistaken ❓
@CHE1RON I’ve digged through Kirby’s source and it seems like the HasMethods
trait only searches Kirby’s built-in methods.
Alright, thanks for letting me know. If I can lend a hand, let me know, Discord or otherwise.
Hey there,
this line will always return
false
even if such method exists, since custom page methods don't exist on the$page
object. Problem is line 32:Because of this,
$page->metadata
is not populated, hence our check on line 86 never succeeds, rendering custom page method 'metadata' useless 😭 If a page method does not exist, Kirby assumes it's aField
with valuenull
😕Solution:
hasMethod
to the rescue:Voila! PR welcome, I guess? 🤣