$menu_icon not working in SS4.2.1

Silverstripe Version: 4.2.1

After an update from SS4.0.3 to SS4.2.1, the custom menu icons won’t work anymore. Now it uses the fallback icon with the class “font-icon-circle-star”. The custom icons are placed in the themes folder.

private static $menu_icon = "themes/cms/icons/stop-grey.png";

In ModelAdmin, the definition has changed from $menu_icon to $menu_icon_class

Actually, $menu_icon_class is an additional option. $menu_icon still exists on LeftAndMain, which ModelAdmin extends from, so you should be able to use either :slight_smile:

@Carlo_R is your themes/cms/icons/ directory exposed as a public resource? https://docs.silverstripe.org/en/4/changelogs/4.1.0/#expose-root-files

True, but Carlo might have opted in. I think the docs encourage it.

Since it was an upgrade from 4.0.x to 4.2, it shouldn’t have forced the presence of the public directory structure I thought?

I’m working with @Carlo_R on this, so exposing the icons did seem to do the trick. But unfortunately still no correct icon :face_with_raised_eyebrow:

This is in the body of the document

.icon.icon-16.icon-toptenbookadmin { background-image: url('http://localhost/project.dev/public/resources/themes/klant/icons/book25px.png'); }

But that doesn’t seem to match the correct element:
<span class=“menu__icon font-icon-circle-star font-icon-toptenbookadmin”>&nbsp;</span>

So is it possible the .icon and .icon-16 are not used anymore? Or are we missing something else?

I don’t know if this is related, but if you’re using the public directory structure then that should be your web root. So the URL should be more like _http://project.dev/resources/themes/klant/icons/book25px.png_

thanks @JonoM, but the URL to the resource doesn’t seem to be the problem anymore. If I put it in my browser it just works.

Thing is, that the CSS selector doesn’t match the left-side of the admin-screen (with .icon.icon-16 in it).

Looks like you found a bug! Appears that this line needs to be updated: silverstripe-admin/LeftAndMain.php at db9de461a957ae87e793113b07aabd795f5deaea · silverstripe/silverstripe-admin · GitHub

Would you care to create an issue and/or pull request to fix this?

ah, I guess someone beat me to it: 1.2.x - private static $menu_icon has no effect · Issue #558 · silverstripe/silverstripe-admin · GitHub

i’m using 4.4.1@stable in my composer.json

when i change the setting of private static $menu_icon its not changing in the cms … i’ve tried dev/build?flush=all …

flush=all and

I’ve deleted everything in silverstripe-cache

i mistakenly set it to private static $menu_icon = “icons/banner.png”;

and although i’ve changed it to private static $menu_icon = “public/icons/banner.png”;
this is not refleceted in the browser inspector.
background-image: https://clientwebsitedomain.co.uk/icons/banner.png

default install site structure
.htaccess {RewriteRule ^(.*)$ public/$1}

if i go to https://clientwebsitedomain.co.uk/public/icons/banner.png i see the image