show errors in custom single page layout

Submitted by remo - 3 years ago

When you overwrite an existing single page layout (e.g. /login), you'll have to handle the possible errors raised by that page manually in your theme's view.php.

// Display errors as UL / LI structure
Loader::element('system_errors', array('error' => $error));

// Display errors as DIV structure
Loader::element('system_errors', array('error' => $error, 'format' => 'block'));

// Display custom structure
if (isset($error) && $error != '') {
    if ($error instanceof Exception) {
        $_error[] = $error->getMessage();
    } else if ($error instanceof ValidationErrorHelper) {
        $_error = $error->getList();
    } else if (is_array($error)) {
        $_error = $error;
    } else if (is_string($error)) {
        $_error[] = $error;
    }
    if ($_error) {
        foreach ($_error as $e) {
            echo '<p>' . $e . '</p>';
        }
    }
}
Stats Categories Tags
comments powered by Disqus