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

setTreeBaseID for SimpleTreeDropdownField


Reply

4 Posts   1462 Views

Avatar
schellmax

13 January 2010 at 6:46am (Last edited: 13 January 2010 6:48am), Community Member, 126 Posts

i just found that SimpleTreeDropdownField doesn't have a 'setTreeBaseID' method (as the 'regular' TreeDropdownField has - see http://api.silverstripe.org/forms/fields-relational/TreeDropdownField.html#$treeBaseID).

i had a glance at the code and found a quick way to add this functionality:

- just add one more param ($baseID) to the constructor:

function __construct($name, $title = "", $sourceClass = "SiteTree", $value = "", $form = null, $emptyString = null, $baseID = 0)

- then, use it in the 'getHierarchy' call:

parent::__construct($name, $title, $this->getHierarchy($baseID), $value, $form, $emptyString);

that's it - maybe you want to add this in svn, unclecheese?

Avatar
UncleCheese

13 January 2010 at 7:04am 4085 Posts

Awesome.. thanks. Lots of new stuff will be coming in soon, so I'll roll this in, too.

Avatar
schellmax

22 June 2010 at 3:54am Community Member, 126 Posts

just needed this again in a current project and couldn't find it in the source (r402), maybe you just forgot?

Avatar
schellmax

2 February 2012 at 5:46am Community Member, 126 Posts

back again: it's in now
don't know as of which revision, but thanks anyway!