Custom SilverStripe Sorting Pages List

Is there a way to sort the list of pages in the menu to create a page for an individual order (instead of alphabetical text).

I am looking for a solution similar to how the ModelAdmin menu items are ordered:

private static $menu_priority = 2;

enter image description here

+4
source share
1 answer

Currently not, force it to hard code the sorting by "Singular Name", see https://github.com/silverstripe/silverstripe-cms/blob/3.5/code/controllers/CMSMain.php#L493

CMSMain, PageTypes() SilverStripe Injector.

:.

class CustomCMSMain extends CMSMain {

    public function init() {
        parent::init(); //set a breakpoint here to prove this class is called
    }

    public function PageTypes() {
        //do something
    }
}

config.yml

Injector:
  CMSMain:
    class: CustomCMSMain 

SilverStripe , , xdebug , . init.

. docs

+2

Source: https://habr.com/ru/post/1663135/


All Articles