Try the beta version of the new SilverStripe documentation

For the next 2 weeks you can use the new documentation website and give us your feedback.


This document contains information for an outdated version (3.0) and may not be maintained any more.

If some of your projects still use this version, consider upgrading as soon as possible.

How to customize the CMS Menu #

Defining a Custom Icon ##

Every time you add a new extension of the api:LeftAndMain class to the CMS, SilverStripe will automatically create a new menu-item for it, with a default title and icon. We can easily change that behaviour by using the static $menu_title and $menu_icon statics to provide a custom title and icon.

The most popular extension of LeftAndMain is the api:ModelAdmin class, so we'll use that for an example. We'll take the ProductAdmin class used in the ModelAdmin reference.

First we'll need a custom icon. For this purpose SilverStripe uses 16x16 black-and-transparent PNG graphics. In this case we'll place the icon in mysite/images, but you are free to use any location.

class ProductAdmin extends ModelAdmin {
    // ...
    static $menu_icon = 'mysite/images/product-icon.png'; 

Defining a Custom Title ##

The title of menu entries is configured through the $menu_title static. If its not defined, the CMS falls back to using the class name of the controller, removing the "Admin" bit at the end.

class ProductAdmin extends ModelAdmin {
    // ...
    static $menu_title = 'My Custom Admin'; 
In order to localize the menu title in different languages, use the `.MENUTITLE`

entity name, which is automatically created when running the i18n text collection. For more information on language and translations, please refer to the i18n docs.


Comment policy: Please use comments for tips and corrections about the described functionality.
Comments are moderated, we reserve the right to remove comments that are inappropriate or are no longer relevant. Use the Silverstripe Forum to ask questions.

blog comments powered by Disqus