mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
a87a857a6e
Remove @package / @subpackage Fix inifinite loop in VirtualPage_Controller
30 lines
684 B
PHP
30 lines
684 B
PHP
<?php
|
|
|
|
namespace SilverStripe\CMS\Logging;
|
|
|
|
use SilverStripe\CMS\Model\ErrorPage;
|
|
use SilverStripe\Control\Director;
|
|
use SilverStripe\Logging\DebugViewFriendlyErrorFormatter;
|
|
|
|
/**
|
|
* Provides {@see ErrorPage}-gnostic error handling
|
|
*/
|
|
class ErrorPageErrorFormatter extends DebugViewFriendlyErrorFormatter {
|
|
|
|
public function output($statusCode) {
|
|
// Ajax content is plain-text only
|
|
if(Director::is_ajax()) {
|
|
return $this->getTitle();
|
|
}
|
|
|
|
// Determine if cached ErrorPage content is available
|
|
$content = ErrorPage::get_content_for_errorcode($statusCode);
|
|
if($content) {
|
|
return $content;
|
|
}
|
|
|
|
// Fallback to default output
|
|
return parent::output($statusCode);
|
|
}
|
|
}
|