Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT Allowing custom 'root forms' when id values '0' or 'root'…

… are passed from the tree selection.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@98710 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit 49dd8ddfa5e3b42ad04b008fe6582789592478ac 1 parent 52c5e35
@chillu chillu authored
Showing with 7 additions and 3 deletions.
  1. +6 −2 code/LeftAndMain.php
  2. +1 −1  javascript/LeftAndMain.Tree.js
View
8 code/LeftAndMain.php
@@ -513,7 +513,7 @@ function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $fil
// Wrap the root if needs be.
if(!$rootID) {
- $rootLink = '#';
+ $rootLink = $this->Link('show') . '/root';
// This lets us override the tree title with an extension
if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle();
@@ -820,12 +820,16 @@ public function getEditForm($id = null) {
$form->setFields($readonlyFields);
}
} else {
- $form = $this->EmptyForm();
+ $form = $this->RootForm();
}
return $form;
}
+ function RootForm() {
+ return $this->EmptyForm();
+ }
+
/**
* Returns a placeholder form, used by {@link getEditForm()} if no record is selected.
* Our javascript logic always requires a form to be present in the CMS interface.
View
2  javascript/LeftAndMain.Tree.js
@@ -26,7 +26,7 @@ var _HANDLER_FORMS = {
onmatch: function() {
// make sure current ID of loaded form is actually selected in tree
var id = $('#Form_EditForm :input[name=ID]').val();
- if(id) this[0].setCurrentByIdx(id);
+ this[0].setCurrentByIdx(id);
}
};
});
Please sign in to comment.
Something went wrong with that request. Please try again.