Hello,
Since I don't have a code page for Error Pages, is there a way to change their tree icons?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hello,
Since I don't have a code page for Error Pages, is there a way to change their tree icons?
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 :)
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.
Much better solution! Thanks!
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")';
}
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.