sourceClass = $sourceClass; parent::__construct($name, $title, $this->getHierarchy(0), $value, $form, $emptyString); } private function getHierarchy($parentID, $level = 0) { $options = array(); if($children = DataObject::get($this->sourceClass, "ParentID = $parentID")) { foreach($children as $child) { $indent=""; for($i=0;$i<$level;$i++) $indent .= "  "; $options[$child->ID] = empty($child->Title) ? "$indent Untitled" : $indent.$child->MenuTitle; $options += $this->getHierarchy($child->ID, $level+1); } } return $options; } }