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   1514 Views

Avatar
schellmax

Community Member, 126 Posts

13 January 2010 at 6:46am

Edited: 13/01/2010 6:48am

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

Forum Moderator, 4096 Posts

13 January 2010 at 7:04am

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

Avatar
schellmax

Community Member, 126 Posts

22 June 2010 at 3:54am

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

Avatar
schellmax

Community Member, 126 Posts

2 February 2012 at 5:46am

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