From 52bd5092199bddff6d665344d5284a74c9e03b55 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 5 Oct 2009 21:01:01 +0000 Subject: [PATCH] --- _config.php | 1 + code/ErrorPageSubsite.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 code/ErrorPageSubsite.php diff --git a/_config.php b/_config.php index 820266e..a165e7a 100644 --- a/_config.php +++ b/_config.php @@ -15,6 +15,7 @@ Object::add_extension('LeftAndMain', 'ControllerSubsites'); Object::add_extension('Group', 'GroupSubsites'); Object::add_extension('Member', 'MemberSubsites'); Object::add_extension('File', 'FileSubsites'); +Object::add_extension('ErrorPage', 'ErrorPageSubsite'); // Backwards compatibility with SilverStripe 2.2 if(!class_exists('CMSMenu')) { diff --git a/code/ErrorPageSubsite.php b/code/ErrorPageSubsite.php new file mode 100644 index 0000000..5f06a5e --- /dev/null +++ b/code/ErrorPageSubsite.php @@ -0,0 +1,30 @@ +owner->ClassName, 'static_filepath'); + $subdomainPart = ""; + + if($subsite = Subsite::currentSubsite(false)) { + $subdomain = $subsite->Subdomain; + $subdomainPart = "-{$subdomain}"; + } + + if(singleton('SiteTree')->hasExtension('Translatable') && $locale && $locale != Translatable::default_locale()) { + $filepath = $static_filepath . "/error-{$statusCode}-{$locale}{$subdomainPart}.html"; + } else { + $filepath = $static_filepath . "/error-{$statusCode}{$subdomainPart}.html"; + } + + return $filepath; + } + +} \ No newline at end of file