mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
BUGFIX: Don't make CMSSubTreeAdmin require the blog module
This commit is contained in:
parent
8600386ae5
commit
288dd47257
@ -1,24 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test a subtree-admin that only shows the children of a FTPageHolder
|
||||||
|
*/
|
||||||
class CMSSubTreeAdmin extends CMSMain {
|
class CMSSubTreeAdmin extends CMSMain {
|
||||||
// These variables are 2.3-specific; in 2.2.x you will need to edit _config.php
|
// These variables are 2.3-specific; in 2.2.x you will need to edit _config.php
|
||||||
static $url_segment = 'subtree';
|
static $url_segment = 'subtree';
|
||||||
static $menu_title = 'Blog Content';
|
static $menu_title = 'FT Pages';
|
||||||
|
|
||||||
function SiteTreeAsUL() {
|
function SiteTreeAsUL() {
|
||||||
// This piece of code just gets us a root ID to use
|
// This piece of code just gets us a root ID to use
|
||||||
$blogRoot = DataObject::get_one("BlogHolder");
|
$ftRoot = DataObject::get_one("FTPageHolder");
|
||||||
if(!$blogRoot) {
|
if(!$ftRoot) {
|
||||||
$blogRoot = new BlogHolder();
|
$ftRoot = new FTPageHolder();
|
||||||
$blogRoot->write();
|
$ftRoot->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This code is what you will need to do to make a subtree version of CMSMain
|
// This code is what you will need to do to make a subtree version of CMSMain
|
||||||
$this->generateDataTreeHints();
|
$this->generateDataTreeHints();
|
||||||
$this->generateTreeStylingJS();
|
$this->generateTreeStylingJS();
|
||||||
|
|
||||||
// blogRoot->ID is your root node
|
// ftRoot->ID is your root node
|
||||||
$siteTree = $this->getSiteTreeFor("SiteTree", $blogRoot->ID);
|
$siteTree = $this->getSiteTreeFor("SiteTree", $ftRoot->ID);
|
||||||
|
|
||||||
// This code is copied from getSiteTreeFor(), because getSiteTreeFor has it hard-coded to only generate if rootID = 0
|
// This code is copied from getSiteTreeFor(), because getSiteTreeFor has it hard-coded to only generate if rootID = 0
|
||||||
$rootLink = $this->Link() . '0';
|
$rootLink = $this->Link() . '0';
|
||||||
|
5
code/model/FTPage.php
Normal file
5
code/model/FTPage.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class FTPage extends Page {
|
||||||
|
|
||||||
|
}
|
6
code/model/FTPageHolder.php
Normal file
6
code/model/FTPageHolder.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class FTPageHolder extends Page {
|
||||||
|
static $default_child = 'FTPage';
|
||||||
|
static $allowed_children = 'FTPage';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user