Is there a way to sort the list of pages in the create page menu by a custom order (instead of alphabetically ie).
I'm looking for a solution similar to the way ModelAdmin menu items are ordered:
private static $menu_priority = 2;
Is there a way to sort the list of pages in the create page menu by a custom order (instead of alphabetically ie).
I'm looking for a solution similar to the way ModelAdmin menu items are ordered:
private static $menu_priority = 2;
Currently not, cause it's hardcoded to sort by "Singular Name", see https://github.com/silverstripe/silverstripe-cms/blob/3.5/code/controllers/CMSMain.php#L493
Nevertheless you could subclass CMSMain
class, overwrite the method PageTypes()
and tell SilverStripe to use your subclass instead of the original with an Injector.
E.g.:
class CustomCMSMain extends CMSMain {
public function init() {
parent::init(); //set a breakpoint here to prove this class is called
}
public function PageTypes() {
//do something
}
}
and in your config.yml
Injector:
CMSMain:
class: CustomCMSMain
After a flush SilverStripe should use your own class which you can easily verify by setting a xdebug breakpoint in your own class, e.g. in the init method.