Semicolon
Semicolon

Reputation: 1914

SilverStripe change $menu_icon in CMSPageController

I'm trying to change the $menu_icon variable in CMSPageController without editing core files (IE: the icon next to menu item "Pages" in the CMS). I went on a limb and tried the following:

1: Define an extension to CMSPageController in _config.yml

CMSPageController:
  extensions:
    - ChangeMenuIcon

2: Define class and extend from CMSPageControllerExtension in mysite

class ChangeMenuIcon extends CMSPageControllerExtension {
    private static $menu_icon = 'framework/admin/images/menu-icons/16x16/information.png';
}

This results in a 500 error. Is this actually the correct way to overwrite an existing (core) class property?

Upvotes: 1

Views: 138

Answers (1)

muskie9
muskie9

Reputation: 476

Faloude, since it's a private static you could try setting it directly in the config.yml rather than applying an extension.

CMSPagesController:
  menu_icon: 'framework/admin/images/menu-icons/16x16/information.png';

Upvotes: 3

Related Questions