Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » dynamic cms sitetree icon

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 2942 Views
  • keeny
    Avatar
    Community Member
    48 Posts

    dynamic cms sitetree icon Link to this post

    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

  • drye
    Avatar
    Community Member
    49 Posts

    Re: dynamic cms sitetree icon Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: dynamic cms sitetree icon Link to this post

    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

  • Lukin
    Avatar
    Community Member
    42 Posts

    Re: dynamic cms sitetree icon Link to this post

    have found a solution for changing the icon?

  • Devis
    Avatar
    Community Member
    4 Posts

    Re: dynamic cms sitetree icon Link to this post

    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")

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: dynamic cms sitetree icon Link to this post

    You dont need the file part:

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

  • Invader_Zim
    Avatar
    Community Member
    141 Posts

    Re: dynamic cms sitetree icon Link to this post

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

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

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

    Cheers,
    Christian

  • Devis
    Avatar
    Community Member
    4 Posts

    Re: dynamic cms sitetree icon Link to this post

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

    2942 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.