Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Icons of "folders" in the CMS, Bug ?


3 Posts   1223 Views


29 January 2010 at 10:23pm Community Member, 67 Posts

Hello :)

I would like to change icons in the CMS so i used the static $icon property of my new class like in the [url=]Tutorial 2 : Extending a basic Site[/url] :

class myHolder extends Page {

static $icon = array( "mysite/images/treeicons/myHolder", "folder" );


And i put my 2 icons ('myHolder-openfolder.gif' and 'myHolder-closedfolder.gif') in 'mysite/images/treeicons/'

The $icon property works great for "file" but not "folder" option : i can't have "open" and "closed" icons !? I see only the "open" icon in the CMS...


29 January 2010 at 10:45pm Community Member, 67 Posts

I think i've found the problem : in the 'cms/code/CMSMain.php' file, in generateTreeStylingJS() method, line 251-253, i found :

if(!Director::fileExists($openFolderImage)|| $option = "file" ) $openFolderImage = $fileImage;

$closedFolderImage = $icon . '-closedfolder.gif';
if(!Director::fileExists($closedFolderImage) || $option = "file") $closedFolderImage = $fileImage;

I changed these lines by ($option = "file" --> $option == "file") :

if(!Director::fileExists($openFolderImage)|| $option == "file" ) $openFolderImage = $fileImage;

$closedFolderImage = $icon . '-closedfolder.gif';
if(!Director::fileExists($closedFolderImage) || $option == "file") $closedFolderImage = $fileImage;

And it works ! Now i see my closedfolder icon and when i open it, i see the openfolder icon in the CMS tree.


2 February 2010 at 11:18pm Community Member, 126 Posts

confirmed - i created a ticket at
thanks for sharing