From ddf66c1fec95c8c733fc674e8f305918c7d5539c Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Oct 2010 01:28:02 +0000 Subject: [PATCH] BUGFIX Fixed SiteTree::page_type_classes() removal of base class (was broken if database driver returned classes in arbitrary order, e.g. in Postgres) (from r102026) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112058 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/SiteTree.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 57d98bdab..748328731 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -295,7 +295,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid */ public static function page_type_classes() { $classes = ClassInfo::getValidSubClasses(); - array_shift($classes); + if($baseClassIndex = array_search('SiteTree', $classes)) unset($classes[$baseClassIndex]); + $kill_ancestors = array(); // figure out if there are any classes we don't want to appear @@ -318,7 +319,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid unset($classes[$idx]); } } - + return $classes; }