Jump to:

5519 Posts in 1734 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Changing Tree Icons for Error Pages

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

Page: 1
Go to End
Author Topic: 2118 Views
  • DanStephenson
    Avatar
    Community Member
    115 Posts

    Changing Tree Icons for Error Pages Link to this post

    Hello,

    Since I don't have a code page for Error Pages, is there a way to change their tree icons?

  • ambient
    Avatar
    Community Member
    123 Posts

    Re: Changing Tree Icons for Error Pages Link to this post

    Did you ever figure this one out Dan?

    I've tried by changing this line:

    static $icon = array("sapphire/javascript/tree/images/page", "file");

    to

    static $icon = array("sapphire/javascript/tree/images/page", "error");

    in sapphire\core\model\ErrorPage.php

    I added page-error.gif and png to the sapphire\javascript\tree\images folder but it still displays the original page-file icon.

    Whats weird is if I remove the line of code from the page then the error page icons disappear.

    Any ideas??

    Cheers

  • rohitbanerjee
    Avatar
    Community Member
    7 Posts

    Re: Changing Tree Icons for Error Pages Link to this post

    Did you try doing this in the _config.php file?

    ErrorPage::$icon = array('themes/rohitbanerjee-blocko/images/icons/error',"file");

    It worked for me and this way you dont have to touch or modify your Error page php file.

  • DanStephenson
    Avatar
    Community Member
    115 Posts

    Re: Changing Tree Icons for Error Pages Link to this post

    Much better solution! Thanks!

  • Rossel
    Avatar
    Community Member
    18 Posts

    Re: Changing Tree Icons for Error Pages Link to this post

    This no longer works for 3.1. how is it done now?

    Edit:
    I managed resolved this by extending my error & redirector pages.

    <?php
    class MyErrorPage extends ErrorPage {
    // set new icon
    private static $icon = 'mysite/images/icons/broken.png';
    // remove old error page from list
    private static $hide_ancestor = 'ErrorPage';

    // set name and description to appear as before
    private static $singular_name = 'Error Page';
    private static $plural_name = 'Error Pages';
    private static $description = 'Custom content for different error cases (e.g. "Page not found")';      
    }

  • RuthAdele
    Avatar
    Community Member
    19 Posts

    Re: Changing Tree Icons for Error Pages Link to this post

    Hey Rossel, you now do this in the mysite/_config/config.yml file.
    So it would be:

    ErrorPage:
    icon:
    'mysite/images/icons/broken.png'

    Note:
    - there should be two spaces for each indentation. (2 in front of icon, and 4 in front of 'mysite... (formatting here is removing my preceeding spaces)
    - also be sure not to have any other spaces or tabs after lines, as these will cause an error.

    2118 Views
Page: 1
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.