1 <?php
2 class ErrorPageSubsite extends DataObjectDecorator {
3
4 5 6 7 8 9 10 11
12 function alternateFilepathForErrorcode($statusCode, $locale = null) {
13 $static_filepath = Object::get_static($this->owner->ClassName, 'static_filepath');
14 $subdomainPart = "";
15
16
17 $subsite = Subsite::currentSubsite(false);
18
19
20 if(!$subsite) {
21 $subsiteID = Subsite::getSubsiteIDForDomain();
22 if($subsiteID != 0) $subsite = DataObject::get_by_id("Subsite", $subsiteID);
23 else $subsite = null;
24 }
25
26 if($subsite) {
27 $subdomain = preg_replace('!/!', '', $subsite->domain());
28 $subdomainPart = "-{$subdomain}";
29 }
30
31 if(singleton('SiteTree')->hasExtension('Translatable') && $locale && $locale != Translatable::default_locale()) {
32 $filepath = $static_filepath . "/error-{$statusCode}-{$locale}{$subdomainPart}.html";
33 } else {
34 $filepath = $static_filepath . "/error-{$statusCode}{$subdomainPart}.html";
35 }
36
37 return $filepath;
38 }
39
40 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-