I'm trying to override the PageTypes() method in CMSMain class which populates a list of pages which can be created by the CMS user. My final goal is to change the sort of the page list which is now based on 'singular_name'. But I'm stuck at how to tell SS to use my custom method rather than the original one.
class CMSMainHook extends CMSMain {
public function PageTypes() {
// Get the original method return (list of pages, sorted by singular_name)
$pages = parent::PageTypes();
// Sort by my custom property $pos instead
$pages->sort('post');
// So what now?
}
}
I've read the documentation on Injector but besides being a bit vague to me, the code just scrambles the page section of the cms so I guess either I'm not using the injector properly or my goal is not achievable using Injector.