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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

TreeDropdownField with only one folder


Go to End


2 Posts   2049 Views

Avatar
snaip

Community Member, 181 Posts

15 January 2010 at 1:38am

hi

i'm using TreeDropdownField to get file from assets folders
but it showing me all the folders in asset , i want only one

i have
/assets
..../images
..../pdf
..../flash

i want to get only pdf folder in TreeDropdownField

static $has_one = array(
'PDF' => 'File'
);
$fields->addFieldToTab("Root.Content.Plik pdf", new TreeDropdownField('PDFID', 'Choose pdf file', 'File'));

Avatar
MateuszU

Community Member, 89 Posts

18 January 2010 at 4:18pm

How about this:

$tree = new TreeDropdownField('PDFID', 'Choose pdf file', 'File');
$tree->setTreeBaseID([the id of the root folder to browse]);
$fields->addFieldToTab("Root.Content.Plik pdf", $tree);

m.