Is there any way to create a global model for all Page
objects?..
or Is there any way to add a method for all Page
objects as the same way as the fields ??
I don’t know, maybe something like:
page::$methods['myMethod'] = function($page) {
// ...
}
So I could run the method directly for the page instance: $page->myMethod()
Yes, but not as elegant as it could be:
Create a plugin with your custom base class in it (just like a model), let it extend Page
and name it however you want.
Create a model for every template, but let it extend your custom class instead of Page
.
oh!
This is just what I don’t want to do, As you says, This is not so elegant especially because I have a lot of different kind of Pages.
This feature has been requested a few times now, so maybe it will find its way into the core in an elegant way.
1 Like
I would love to have this feature, too.
1 Like
iancox
February 26, 2016, 3:47am
6
+1 —I’ve been looking for a way to do this as well
1 Like
There is a github issue for this one now as well: https://github.com/getkirby/kirby/issues/390
2 Likes