BUGFIX: Don't make CMSSubTreeAdmin require the blog module

This commit is contained in:
Sam Minnee 2010-02-01 21:34:17 +00:00
parent 8600386ae5
commit 288dd47257
3 changed files with 21 additions and 7 deletions

View File

@ -1,24 +1,27 @@
<?php
/**
* Test a subtree-admin that only shows the children of a FTPageHolder
*/
class CMSSubTreeAdmin extends CMSMain {
// These variables are 2.3-specific; in 2.2.x you will need to edit _config.php
static $url_segment = 'subtree';
static $menu_title = 'Blog Content';
static $menu_title = 'FT Pages';
function SiteTreeAsUL() {
// This piece of code just gets us a root ID to use
$blogRoot = DataObject::get_one("BlogHolder");
if(!$blogRoot) {
$blogRoot = new BlogHolder();
$blogRoot->write();
$ftRoot = DataObject::get_one("FTPageHolder");
if(!$ftRoot) {
$ftRoot = new FTPageHolder();
$ftRoot->write();
}
// This code is what you will need to do to make a subtree version of CMSMain
$this->generateDataTreeHints();
$this->generateTreeStylingJS();
// blogRoot->ID is your root node
$siteTree = $this->getSiteTreeFor("SiteTree", $blogRoot->ID);
// ftRoot->ID is your root node
$siteTree = $this->getSiteTreeFor("SiteTree", $ftRoot->ID);
// This code is copied from getSiteTreeFor(), because getSiteTreeFor has it hard-coded to only generate if rootID = 0
$rootLink = $this->Link() . '0';

5
code/model/FTPage.php Normal file
View File

@ -0,0 +1,5 @@
<?php
class FTPage extends Page {
}

View File

@ -0,0 +1,6 @@
<?php
class FTPageHolder extends Page {
static $default_child = 'FTPage';
static $allowed_children = 'FTPage';
}