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 ?


Go to End
Reply


3 Posts   1305 Views

Avatar
Myrdhin

Community Member, 69 Posts

29 January 2010 at 10:23pm

Hello :)

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


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...

Avatar
Myrdhin

Community Member, 69 Posts

29 January 2010 at 10:45pm

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.

Avatar
schellmax

Community Member, 126 Posts

2 February 2010 at 11:18pm

confirmed - i created a ticket at http://open.silverstripe.org/ticket/5019
thanks for sharing