Skip to content
Browse files

Added the parent as an option in the SimpleTreeDropdownField

  • Loading branch information...
1 parent 3c33e68 commit 0cedc2827c5a8d1eb8cd79eadad5127496b3aaa8 @aexmachina aexmachina committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 code/dropdown_fields/SimpleTreeDropdownField.php
View
3 code/dropdown_fields/SimpleTreeDropdownField.php
@@ -56,6 +56,9 @@ private function getCachedHierarchy($parentID) {
private function getHierarchy($parentID, $level = 0)
{
$options = array();
+ if( $parentID ) {
+ $options[$parentID] = DataObject::get_by_id($this->sourceClass, $parentID)->__get($this->labelField);
+ }
$class = ($this->sourceClass == "SiteTree" || is_subclass_of($this->sourceClass, "SiteTree")) ? "SiteTree" : $this->sourceClass;
$filter = ($this->filter) ? "\"ParentID\" = $parentID AND $this->filter" : "\"ParentID\" = $parentID";
if($children = DataObject::get($class, $filter)) {

0 comments on commit 0cedc28

Please sign in to comment.
Something went wrong with that request. Please try again.