mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
bfojcapell: If we are visiting a multilingual site Translatable::get_one should be used
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42114 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
970a453cb8
commit
4ceb428cb5
@ -125,6 +125,7 @@ class Director {
|
|||||||
if($_REQUEST['debug'] == 1) Debug::message("Redirecting to $controller");
|
if($_REQUEST['debug'] == 1) Debug::message("Redirecting to $controller");
|
||||||
|
|
||||||
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
|
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
|
||||||
|
|
||||||
return "redirect:" . Director::absoluteURL(substr($controller,2), true);
|
return "redirect:" . Director::absoluteURL(substr($controller,2), true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -147,6 +148,7 @@ class Director {
|
|||||||
if(isset($arguments['URLSegment'])) self::$urlSegment = $arguments['URLSegment'] . "/";
|
if(isset($arguments['URLSegment'])) self::$urlSegment = $arguments['URLSegment'] . "/";
|
||||||
|
|
||||||
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
|
if(isset($_GET['debug_profile'])) Profiler::unmark("Director","getControllerForURL");
|
||||||
|
|
||||||
return $controllerObj;
|
return $controllerObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +167,11 @@ class Director {
|
|||||||
static function currentPage() {
|
static function currentPage() {
|
||||||
if(isset(Director::$urlParams['URLSegment'])) {
|
if(isset(Director::$urlParams['URLSegment'])) {
|
||||||
$SQL_urlSegment = Convert::raw2sql(Director::$urlParams['URLSegment']);
|
$SQL_urlSegment = Convert::raw2sql(Director::$urlParams['URLSegment']);
|
||||||
return DataObject::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
|
if (Translatable::is_enabled()) {
|
||||||
|
return Translatable::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
|
||||||
|
} else {
|
||||||
|
return DataObject::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return Controller::currentController();
|
return Controller::currentController();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user