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 /

Changing Tree Icons for Error Pages


Reply


6 Posts   2323 Views

Avatar
DanStephenson

Community Member, 116 Posts

17 February 2009 at 9:13pm

Hello,

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

Avatar
ambient

Community Member, 123 Posts

17 June 2011 at 1:58am

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

Avatar
rohitbanerjee

Community Member, 7 Posts

29 June 2011 at 1:26am

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.

Avatar
DanStephenson

Community Member, 116 Posts

23 September 2011 at 8:16am

Much better solution! Thanks!

Avatar
Rossel

Community Member, 18 Posts

15 February 2014 at 7:41pm

Edited: 17/02/2014 3:16pm

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")';      
}

Avatar
RuthAdele

Community Member, 19 Posts

4 July 2014 at 12:02pm

Edited: 04/07/2014 12:05pm

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.