-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH Display error messages in admin with an admin context
- Loading branch information
1 parent
f58e4aa
commit a66c668
Showing
5 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Admin; | ||
|
||
use SilverStripe\Control\Director; | ||
use SilverStripe\Control\HTTPRequest; | ||
use SilverStripe\Core\Extension; | ||
|
||
class LeftAndMainErrorExtension extends Extension | ||
{ | ||
/** | ||
* Used by {@see RequestHandler::httpError} | ||
*/ | ||
public function onBeforeHTTPError($statusCode, HTTPRequest $request, $errorMessage = null) | ||
{ | ||
if (Director::is_ajax($request)) { | ||
return; | ||
} | ||
$this->owner->setHttpErrorMessage($errorMessage); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
templates/SilverStripe/Admin/Includes/LeftAndMain_NotFound.ss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="cms-content flexbox-area-grow $BaseCSSClasses" data-layout-type="border" data-pjax-fragment="Content"> | ||
|
||
<div class="cms-content-header north"> | ||
<div class="cms-content-header-info vertical-align-items flexbox-area-grow"> | ||
<div class="breadcrumbs-wrapper"> | ||
<span class="cms-panel-link crumb last"> | ||
$ErrorType | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
$Tools | ||
|
||
<div class="panel panel--padded"> | ||
$Message | ||
<% if $isDev && $HttpErrorMessage %> | ||
<p> | ||
<strong><%t SilverStripe\Admin\LeftAndMain.ErrorDetail "Error detail: {detail}" detail=$HttpErrorMessage %></strong> | ||
</p> | ||
<% end_if %> | ||
</div> | ||
|
||
</div> |