silverstripe-cms/code/controllers/ErrorPageFileExtension.php
Damian Mooyman 1c907dd227 API Support versioned File management
API Decouple File and ErrorPage
API Link tracking is now only performed on stage (in lieu of versioned relationships)
API Refactor versioned API methods out of SiteTree and into Versioned
2016-02-22 12:25:25 +13:00

19 lines
426 B
PHP

<?php
/**
* 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();
}
}