silverstripe-cms/code/Controllers/ErrorPageFileExtension.php
Damian Mooyman 041d12129a
Fix regressions from namespacing
Update template locations
Add permission codes to cms sections
Code, phpdoc, and typehint cleanup
Split batch actions into files
2016-08-16 11:56:34 +12:00

25 lines
575 B
PHP

<?php
namespace SilverStripe\CMS\Controllers;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Model\ErrorPage;
/**
* Decorates {@see File} with ErrorPage support
*/
class ErrorPageFileExtension extends DataExtension {
/**
* Used by {@see File::handle_shortcode}
*
* @param int $statusCode HTTP Error code
* @return DataObject Substitute object suitable for handling the given error code
*/
public function getErrorRecordFor($statusCode) {
return ErrorPage::get()->filter("ErrorCode", $statusCode)->first();
}
}