Theming Exception Error

Permalink
Hi,

I would like to wrap Exception view in my current active theme.

As explain in this page (http://www.concrete5.org/documentation/developers/system/error-handling), just adding a template file named "error.php" inside my theme do the job. But this does no work.

Then, I tried to do the same logic as for single page in the site_themes_path.php. This does not work.

Finally, I seen that the View::renderError use DIRNAME_THEMES_CORE constant. So, I decided to define it in site.php. It work but not wrapped in the theme becauseexception is render before the theme...

Is there a good way to do that ?
Why does not use the same logic as for single pages?

e.g /login/change_password/ throw new exception when using wwrong key. I think this should not be an exception, but a simple error shown to the user.

thanks
Best,
kbsd

kbsd
 
mnakalay replied on at Permalink Reply
mnakalay
Hello,
I have never tried that error.php bit in a theme. The core however uses it so maybe if you look at the code you'll be able to emulate what they do.

look in ROOT/concrete/themes/core/error.php
kbsd replied on at Permalink Reply
kbsd
Yes, already checked but so tricky...
jgarcia replied on at Permalink Reply
jgarcia
In case anyone stumbles across this post - it looks like it's not really possible to do now (8.4.3). Here's the code that renders the error output:

public function setupRender()
    {
        $this->setViewTheme(VIEW_CORE_THEME);
        $this->loadViewThemeObject();
        $locator = new FileLocator(new Filesystem(), Facade::getFacadeApplication());
        $r = $locator->getRecord(DIRNAME_THEMES . '/' . DIRNAME_THEMES_CORE . '/' . FILENAME_THEMES_ERROR . '.php');
        $this->setViewTemplate($r->getFile());
    }


This is from src/View/ErrorView.php. So, it's hard-coded to look at error.php in the core theme.