ENHANCEMENT Removing specialized routing for Translatable from Director->currentPage() and ModelAsController->getNestedController. Calls SiteTree::get_by_url() now, which abstracts out the Translatable handling.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@69952 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-01-10 02:35:15 +00:00 committed by Sam Minnee
parent fb113e589e
commit 0cd41ac16d
2 changed files with 3 additions and 10 deletions

View File

@ -287,11 +287,7 @@ class Director {
static function currentPage() {
if(isset(Director::$urlParams['URLSegment'])) {
$SQL_urlSegment = Convert::raw2sql(Director::$urlParams['URLSegment']);
if (Translatable::is_enabled()) {
return Translatable::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
} else {
return DataObject::get_one("SiteTree", "URLSegment = '$SQL_urlSegment'");
}
return SiteTree::get_by_url($SQL_urlSegment);
} else {
return Controller::curr();
}

View File

@ -32,11 +32,8 @@ class ModelAsController extends Controller implements NestedController {
public function getNestedController() {
if($this->urlParams['URLSegment']) {
$SQL_URLSegment = Convert::raw2sql($this->urlParams['URLSegment']);
if (Translatable::is_enabled()) {
$child = Translatable::get_one("SiteTree", "URLSegment = '$SQL_URLSegment'", false);
} else {
$child = DataObject::get_one("SiteTree", "URLSegment = '$SQL_URLSegment'", false);
}
$child = SiteTree::get_by_url($SQL_URLSegment);
if(!$child) {
if($child = $this->findOldPage($SQL_URLSegment)) {
$url = Controller::join_links(