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.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

dynamic cms sitetree icon


Go to End
Reply


15 Posts   3179 Views

Avatar
keeny

Community Member, 48 Posts

10 June 2010 at 12:21pm

Hi all,

I know that you can customise the cms page tree using statics such as:

// tree customisation
static $icon = "mysite/images/icons/my-pretty-icon";

Is it possible to make the icon dynamic - either using a function icon() or maybe setting it on an event (page saved, etc)?

Basically under the behaviour tab I want to have a checkbox that affects the icon.

Thanks a lot!

Barry

Avatar
drye

Community Member, 49 Posts

22 September 2010 at 5:24pm

I have the same question as Keeny. Anyone know if this is possible?

Avatar
Willr

Forum Moderator, 5513 Posts

22 September 2010 at 6:30pm

You may be able to overload the default static using Object::set_static('PageType', 'icon', 'path/to/icon.png'); see the set static docs for more info. Not sure if it'll work but its worth a try.

http://api.silverstripe.org/2.4/sapphire/core/Object.html#methodset_static

Avatar
Lukin

Community Member, 42 Posts

29 September 2010 at 10:06pm

have found a solution for changing the icon?

Avatar
Devis

Community Member, 4 Posts

1 November 2010 at 2:57am

using Object::set_static() partially works but it still search for a GIF file, e.g.

Object::set_static('news', 'icon', 'themes/mysite/icons/news.png');

results in

url("themes/mysite/icons/news.png-file.gif")

Avatar
Martijn

Community Member, 271 Posts

1 November 2010 at 3:25am

You dont need the file part:

Object::set_static('ErrorPage', 'icon', 'mysite/images/icons/error');

Avatar
Invader_Zim

Community Member, 141 Posts

1 November 2010 at 4:49am

^^ thats right, but you end up using .gif icons anyway.

I posted a possible enhancement ticket to use .png icons: [url]http://open.silverstripe.org/ticket/6155[/url]

Please tell me what you think about it. Maybe there is still a better way to use .png icons ...

Cheers,
Christian

Avatar
Devis

Community Member, 4 Posts

1 November 2010 at 9:01am

Edited: 01/11/2010 9:01am

Christian that seems a reasonable solution, the extension shouldn't have been hard coded.

Go to Top