ModelAdmin - SS4.2.2. $menu_icon help?


Silverstripe Version: 4.2.2


I can’t get

private static $menu_icon = 'path/to/modeladmin/news-icon.png';

to work in a ModelAdmin class whatever I try.

I looked up the API documentation and there’s a mistake in the menu_icon_for_class method for Example: static $menu-icon = ‘/path/to/image/’;

It definitely is not menu-icon as that doesn’t exist.

What seems to happen is that the CSS in Left and Main icon for the ModelAdmin gets modified to…

class = "menu__icon font-icon-circle-star font-icon-my-namespace-mymodeladminclass"

…rather than use the image path provided.

However if you put an image path that does not exist on the filesystem you also get a fatal error.

Does anyone know how to customise the ModelAdmin icons?

The documentation page for it says 16x16 pixel images so that’s what I made.

Now that my SS4 project is almost finished I wanted to begin tarting it up a bit so it looked nice as well.


You can specify the menu icon class in your extended ModelAdmin class.

 private static $menu_icon_class = 'fa fa-users';


You can include font awesome css in your theme.yml file

    - themes/yourthemefolder/dist/font-awesome/css/font-awesome.min.css


Thanks @sparkcom you are indeed correct.

However SilverStripe 4 doesn’t appear to be using Font Awesome but by using the browser inspector on the class that altered when I used your line of code I was able to find the built in list of available icons from the CSS.

I can’t find them documented anywhere but they all work.



Thank you, another great tip.

This post should probably be moved over to SS4 Tips & Tricks :slight_smile: so others can find it as well.


Actually I do think I’ve seen the Design Systems Manager page before.

Because ModelAdmin menu icon class is undocumented nobody would know to join up the dots though!

I will have a stab at updating the ModelAdmin documentation page.


PR submitted to the Documentation page.


This might be handy for you :slight_smile:


@DorsetDigital That’s awesome! Bookmarking that one.

@Gelert I think this is the closest thing to official documentation for icons (it was mentioned in a blog post once): Design Systems Manager


@Gelert perhaps you want to create a new post over there instead, summarising the takeaways from this discussion so readers can jump straight to the good stuff.