Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » SimpleTreeDropdownField for a DataObject

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 2167 Views
  • uli
    Community Member
    2 Posts

    SimpleTreeDropdownField for a DataObject Link to this post

    First post, so go easy on me... ;)

    I'm having a strange issue with a class derived from DataObject and a SimpleTreeDropdownField. Here's the code:

    class HomePage extends Page {
    static $has_many = array(
    'Spotlights' => 'Spotlight'
    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Focus', new DataObjectManager(
    array('LinkID' => 'Linked Page', 'LinkImageID' => 'Link Image'),
    return $fields;

    class Spotlight extends DataObject {
    static $has_one = array(
    'Link' => 'SiteTree',
    'LinkImage' => 'Image'
    function getCMSFields_forPopup() {
    return new FieldSet(
    new SimpleTreeDropdownField('LinkID', 'Page to link to', 'SiteTree'),
    new ImageField('LinkImage', 'Link image')

    I get the DataObjectManager in the CMS back-end, but when I try to add an entry, I do not get the SimpleTreeDropdownField. If I change 'LinkID' to 'Link' in the SimpleTreeDropdownField call the control shows up but anything I select does not get saved to the DB (obviously).

    What am I doing wrong?

    I'm using SS 2.4.0.


  • uli
    Community Member
    2 Posts

    Re: SimpleTreeDropdownField for a DataObject Link to this post

    Never mind... the solution is in this post.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.