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.
15 Posts 2999 Views
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!
I have the same question as Keeny. Anyone know if this is possible?
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.
have found a solution for changing the icon?
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');
You dont need the file part:
Object::set_static('ErrorPage', 'icon', 'mysite/images/icons/error');
^^ 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 ...
Christian that seems a reasonable solution, the extension shouldn't have been hard coded.