class ErrorPage extends Page (View source)

ErrorPage holds the content for the page of an error response.

Renders the page on each publish action into a static HTML file within the assets directory, after the naming convention /assets/error-.html. This enables us to show errors even if PHP experiences a recoverable error. ErrorPages

Properties

Methods

public
bool
canAddChildren($member = null)

No description

public static 
response_for(int $statusCode)

Get a SS_HTTPResponse to response to a HTTP error code if an ErrorPage for that code is present. First tries to serve it through the standard SilverStripe request method. Falls back to a static file generated when the user hit's save and publish in the CMS

public
requireDefaultRecords()

Ensures that there is always a 404 page by checking if there's an instance of ErrorPage with a 404 and 500 error code. If there is not, one is created when the DB is built.

protected
array
getDefaultRecords()

Returns an array of arrays, each of which defines properties for a new ErrorPage record.

public
getCMSFields()

No description

public
bool
doPublish()

When an error page is published, create a static HTML page with its content, so the page can be shown even when SilverStripe is not functioning correctly before publishing this page normally.

public
mixed
writeStaticPage()

Write out the published version of the page to the filesystem

public
array
fieldLabels(bool $includerelations = true)

No description

public static 
string
get_filepath_for_errorcode(int $statusCode, string $locale = null)

Returns an absolute filesystem path to a static error file which is generated through publish().

public static 
set_static_filepath(string $path) deprecated

Set the path where static error files are saved through publish().

public static 
string
get_static_filepath() deprecated

No description

Details

bool canAddChildren($member = null)

No description

Parameters

$member

Return Value

bool

static SS_HTTPResponse response_for(int $statusCode)

Get a SS_HTTPResponse to response to a HTTP error code if an ErrorPage for that code is present. First tries to serve it through the standard SilverStripe request method. Falls back to a static file generated when the user hit's save and publish in the CMS

Parameters

int $statusCode

Return Value

SS_HTTPResponse

requireDefaultRecords()

Ensures that there is always a 404 page by checking if there's an instance of ErrorPage with a 404 and 500 error code. If there is not, one is created when the DB is built.

protected array getDefaultRecords()

Returns an array of arrays, each of which defines properties for a new ErrorPage record.

Return Value

array

FieldList getCMSFields()

No description

Return Value

FieldList

bool doPublish()

When an error page is published, create a static HTML page with its content, so the page can be shown even when SilverStripe is not functioning correctly before publishing this page normally.

Return Value

bool

mixed writeStaticPage()

Write out the published version of the page to the filesystem

Return Value

mixed

Either true, or an error

array fieldLabels(bool $includerelations = true)

No description

Parameters

bool $includerelations

a boolean value to indicate if the labels returned include relation fields

Return Value

array

static string get_filepath_for_errorcode(int $statusCode, string $locale = null)

Returns an absolute filesystem path to a static error file which is generated through publish().

Parameters

int $statusCode

A HTTP Statuscode, mostly 404 or 500

string $locale

A locale, e.g. 'de_DE' (Optional)

Return Value

string

static set_static_filepath(string $path) deprecated

deprecated 4.0 Use "ErrorPage.static_file_path" instead

Set the path where static error files are saved through publish().

Defaults to /assets.

Parameters

string $path

static string get_static_filepath() deprecated

deprecated 4.0 Use "ErrorPage.static_file_path" instead

No description

Return Value

string