Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

TreeDropdownField in DataObjectManager


3 Posts   1372 Views


Community Member, 189 Posts

23 October 2010 at 2:42am


I'm trying to get a TreeDropdownField in a DataObjectManager but can't seem to make it work. Here is my code

      $SideLinksManager = new DataObjectManager(
             'Label' => 'Label'
         ), 'getCMSFields_forPopup'
      $fields->addFieldToTab('Root.Content.SideLinks', $SideLinksManager);
      return $fields;


class SideLink extends DataObject{
   static $db = array(
      'Label' => 'Varchar(150)'
   static $has_one = array(
      'Parent' => 'SiteTree',
      'Target' => 'SiteTree',
      'Image' => 'Image',
      'PageLink' => 'SiteTree'
   public function getCMSFields(){
      $treeDropDownField = new TreeDropdownField("PageLinkID", "Choose a page to link to", "SiteTree");
      return new FieldSet(
         new TextField('Label', 'Label'),

The label field shows no problem but the drop down does not show up. If I change "PageLinkID" to "PageLink' it will show up but will not expand to show any fields.

What am I doing wrong? thanks!


Forum Moderator, 4096 Posts

23 October 2010 at 3:07am

You need to use SimpleTreeDropdownField.

SilverStripe tips, tutorials, screencasts and more:


Community Member, 189 Posts

23 October 2010 at 3:12am

great, thanks.

And I see in the DataObjectManager docs SimpleTreeDropdownField is listed there. arg, when I get frustrated I forget to check the most obvious places.

Thanks again.