diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index aa3612db..eeae05b9 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -341,7 +341,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr public function SiteTreeHints() { $json = ''; - $classes = ClassInfo::subclassesFor( $this->stat('tree_class') ); + $classes = SiteTree::page_type_classes(); $cacheCanCreate = array(); foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate(); @@ -373,7 +373,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr if($instance instanceof HiddenClass) continue; - if(!$cacheCanCreate[$child]) continue; + if(!array_key_exists($child, $cacheCanCreate) || !$cacheCanCreate[$child]) continue; // skip this type if it is restricted if($instance->stat('need_permission') && !$this->can(singleton($class)->stat('need_permission'))) continue; diff --git a/javascript/CMSMain.AddForm.js b/javascript/CMSMain.AddForm.js index 6e4b7f83..d62e906b 100644 --- a/javascript/CMSMain.AddForm.js +++ b/javascript/CMSMain.AddForm.js @@ -55,6 +55,10 @@ } selectedEl.setSelected(true); selectedEl.siblings().setSelected(false); + + // Disable the "Create" button if none of the pagetypes are available + var buttonState = (this.find('#PageType li:not(.disabled)').length) ? 'enable' : 'disable'; + this.find('button[name=action_doAdd]').button(buttonState); } }); diff --git a/templates/ContentController.ss b/templates/ContentController.ss index d581620c..505177a3 100644 --- a/templates/ContentController.ss +++ b/templates/ContentController.ss @@ -1,5 +1,5 @@ - - + + <% base_tag %> @@ -9,7 +9,7 @@

$Title

$Content $Form - +

Generated with the default ContentController.ss template