mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENHANCEMENT Creation of a new page type now uses a consistent source of classes that respect $hide_ancestor on SiteTree.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@70131 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e06d884d04
commit
dd61569d6c
@ -312,30 +312,9 @@ JS;
|
|||||||
* @return DataObjectSet
|
* @return DataObjectSet
|
||||||
*/
|
*/
|
||||||
public function PageTypes() {
|
public function PageTypes() {
|
||||||
$classes = ClassInfo::getValidSubClasses();
|
$classes = SiteTree::page_type_classes();
|
||||||
array_shift($classes);
|
|
||||||
$result = new DataObjectSet();
|
$result = new DataObjectSet();
|
||||||
$kill_ancestors = array();
|
|
||||||
|
|
||||||
// figure out if there are any classes we don't want to appear
|
|
||||||
foreach($classes as $class) {
|
|
||||||
$instance = singleton($class);
|
|
||||||
|
|
||||||
// do any of the progeny want to hide an ancestor?
|
|
||||||
if($ancestor_to_hide = $instance->stat('hide_ancestor')) {
|
|
||||||
// note for killing later
|
|
||||||
$kill_ancestors[] = $ancestor_to_hide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If any of the descendents don't want any of the elders to show up, cruelly render the elders surplus to requirements.
|
|
||||||
if($kill_ancestors) {
|
|
||||||
foreach ($kill_ancestors as $mark) {
|
|
||||||
// unset from $classes
|
|
||||||
$idx = array_search($mark, $classes);
|
|
||||||
unset($classes[$idx]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($classes as $class) {
|
foreach($classes as $class) {
|
||||||
$instance = singleton($class);
|
$instance = singleton($class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user