php


SilverStripe sort page list by custom order


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.
See docs for injector

Related Links

How to create form in Symfony 3 that will be displayed on every subpage in header
Data not saved in database cakephp
includes php files from subfolder in the root
How to make local storage with laravel?
prestashop's live url redirecting to my localhost
website showing index.php file data
CodeIgniter upload fail no error logs no error reporting
How make long PHP script faster?
PHP - Parse XML
Linux Ubuntu PHP Version is different in CLI and in PHPINFO()
PHP curly braces inside strings colour in Notepad++
How to clean background captcha image using imagick
How can I get Magento Each Session values by using Magento frontend cookie value through Web Service?
WooCommerce displaying variable description after variable price
if else condition in jquery ajax response
php fastcgi is crashing if the url contains &start_debug=1

Categories

HOME
oracle
magento2
azure-functions
windows-8.1
paypal-ipn
activemq
mongoid
yql
ipv6
share
gprs
tup
solution
parsley.js
ex
squirrel-sql
corona
rpmbuild
adobe-illustrator
yii2-basic-app
android-permissions
liferay-6.2
qa
eclipse-emf
vuforia
unrar
msdeploy
credit-card
autodesk-model-derivative
infopath2010
mapnik
publishing
aurelia-cli
microsoft-ui-automation
mars-simulator
jacoco-maven-plugin
resampling
viewcontroller
spongycastle
tinyioc
deployd
md5-file
head.js
visual-format-language
spring.net
pen
glassfish-4.1
network-protocols
controllers
google-identity-toolkit
dcount
carmen
piping
deferred-rendering
unsigned
gridbaglayout
voronoi
outlook.com
in-app-billing
smart-tv
openshift-cartridge
compositetype
console.log
android-audiomanager
zend-mail
object-code
xcode6.3.1
screwturn
senchatouch-2.4
miglayout
bittorrent-sync
webaii
gpu-programming
autonumber
compiler-flags
hyphen
hints
bcdedit
dynamic-rdlc-generation
ui-design
semicolon
multiscaleimage
idispatch
clearinterval
word-frequency
net-use
data-dump
representation
page-curl
digiflow
asdoc
external-sorting
database-cloning
icon-language
remote-working
code-camp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App